Installing Pim Core on Windows and IIS

Installing Pim Core on Windows and IIS

Difficulty: 
Let's Rock

In this post we will go through the process of installing PimCore in the WIMP (Windows IIS MySQL PHP) stack.

Getting your system ready

We will install the the necessary packages and tools needed to work in the WIMP stack. Not all these are necessarily needed for Pim Core, but are reguarly used in IIS based Open Source projects.

In an elevated powershell console run the following commands:

Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-RequestFiltering
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-CertProvider
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-CGI
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-ASPNET
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-ASPNET45
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-HttpCompressionDynamic
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-HttpCompressionStatic
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-ApplicationInit
Enable-WindowsOptionalFeature -All -Online -FeatureName IIS-IpSecurity

Using Chocolatey we are going to install all the additional required packages, run the following commands in an elevated command or powershell prompt:

choco install vcredist-all -y
choco install dotnet3.5 -y
choco install dotnet4.5 -y
choco install dotnet4.6.2 -y
choco install dotnet4.7 -y
choco install dotnet4.7.1 -y
choco install dotnet4.7.2 -y
choco install windirstat -y
choco install urlrewrite -v 2.0.20160209 -y
choco install iis-arr -y
choco install sqlserver-odbcdriver -y

We will also need some tools to prepare our development environment:

choco install googlechrome -y
choco install notepadplusplus –y
choco install winmerge -y
choco install sublimetext3 -y
choco install 7zip.install -y
choco install procmon -y
choco install rammap -y
choco install git -y
choco install tortoisegit -y

Installing Chef

Properly setting up and configuring a PHP environment in IIS is a complex and time consuming task. For the purpose of this post we will be using Chef to aid in the deployment and configuration of PHP and IIS. For more details on a manual PHP on IIS setup, see the Installing Drupal On Windows post.

Create a directory to contain the Chef application and configurations:

d:\chef

Inside this folder create a file "update_cmdlet.bat" and drop in the following lines:

mkdir %CD%\cmdlet
powershell -command "(New-Object Net.WebClient).DownloadFile('https://ci.appveyor.com/api/projects/David19767/iischef/artifacts/iischef.cmdlet.zip?branch=1.x','%CD%\chef_cmdlet.zip')"
powershell -command "(new-object -com shell.application).namespace('%CD%\cmdlet').CopyHere((new-object -com shell.application).namespace('%CD%\chef_cmdlet.zip').Items(),16)"
set DESTINATION=%ProgramFiles%\WindowsPowerShell\Modules\Chef
mkdir "%DESTINATION%"
powershell -command "(new-object -com shell.application).namespace('%DESTINATION%').CopyHere((new-object -com shell.application).namespace('%CD%\chef_cmdlet.zip').Items(),16)"
del %CD%\chef_cmdlet.zip

Now run update_cmdlet.bat from an elevated prompt to download and install the Chef powershell commands.

Run the following command to perform the initial Chef setup:

Invoke-ChefSelfInstall -Path 'd:\chef'

Installing Composer

To install composer we need to install a system-wide PHP runtime. To do so use chocolatey:

choco install php -y --version=7.3.10

Then install composer:

https://getcomposer.org/doc/00-intro.md#using-the-installer

To experience better and faster composer installs, install prestissimo globally:

composer global require hirak/prestissimo

Make sure curl is enabled for our global PHP installation, go to:

c:\tools\php73\php.ini

And make sure that you have in it the following line:

extension=php_curl.dll

Installing PimCore

First step is to clone the pimcoreskeleton project into your desired target location:

git clone git@github.com:david-garcia-garcia/pimcoreskeleton.git d:\mypimcoresite

This skeleton contains:

  • A fully automated script for initial build of PimCore
  • The needed files to deploy PimCore using IIS Chef
  • A web.config file that makes Pim Core work on IIS

Before installing, review the following configuration file to adjust domain names and other custom settings:

chef\chef.yml

Run the following command in an elevated powershell prompt.

&.\"d:\mypimcoresite\setup.ps1"

This script does everything needed up to Step 3 in the official PimCore install guide:

https://pimcore.com/docs/5.x/Development_Documentation/Getting_Started/Installation.html#page_2-Install-Pimcore-Sources

If you want to change the installation profile, review the contents of the script before installing to adjust accordingly.

You can follow the remaining steps as they are in the official Guide.

NOTE: Be patient during the install process, setting up the database (step 6 in the installer) can take a very long (i.e. up to one hour) depending on your install profile and it looks as being stuck.

Once finished you can browse your new Pim Core site locally at local.mypimcoresite.com

If you are greeted with this error:

An exception occurred while executing 'SELECT PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS(?)' with params [1]:

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION pimcore.PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS does not exist

This is due to a MySQL compatibility issue (that has already been fixed in current dev). Follow the steps in this post to fix:

https://github.com/pimcore/pimcore/issues/4526#issuecomment-538434522

Cron job is automatically set up by the chef configuration file, you can verify in the Scheduled Tasks.

 

 

 

Add new comment

By: root Sunday, October 6, 2019 - 12:00