Windows IIS 7 removing PHP 5.2.8 and installing PHP 5.3.8

Seems like a simple enough task.

Remove the old PHP 5.2.8 and update via the Official Microsoft site a brand new 5.3.8 PHP version.

Never, never, ever assume!

For those of you that prefer a quick summary the removal of the PHP 5.2.8 via the Uninstall process does not remove / reset the environment variables of PHPRC or PATH. Further it does not remove the Fastcgi settings in the IIS console. Using the Microsoft Installer for PHP on Windows 2008 server does not adjust the environment variables for the new path and does not overwrite but adds new entries into the IIS configuration. The really painful and most time consuming issue was that the installer for Microsoft does not automatically include extensions for MS-SQL, only MySQL !!!

The slightly longer version with links and details follows. Suffice to say at this point if you have found this whilst trying to install SugarCRM, PHP 5.3.8 to work with Windows Server 2008 and IIS 7 then it really is relatively simple once you get past the ‘I would have expected that……’ thought process.

Use the Windows Installer for PHP the current one is 5.3.8 If you dont have the Web Platform Installer it will trigger that installation first. There is information on the learniis pages that provides more detail.

Modify the environmental variables – if upgrading remove / modify the existing – for a first time install add the PHPRC if necessary.

Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables

Select in the System Variables lower panel not the User Variables in the upper panel.

Insert the path, in my case it is C:Program Files (x86)PHPv5.3, to the PHP installation as the first element in the Path command. This saves the system from trawling through all the other application paths and adds minimal overhead for the other applications as there are only a relatively small number of files to check in the PHP directory.

Insert the PHPRC variable and set the same path C:Program Files (x86)PHPv5.3

To test that this is working open a new command window (Start -> Run -> cmd: but if you need this you probably are out of your depth!) and type php -v at the prompt. You should get back a PHP 5.3.8 information text. If you get a not found error then you need to check your install and variable paths actually match.

In the IIS console at the server level open the Handler Mappings icon and confirm that there is only one PHP entry – default should be PHP53_via_FastCGI. Remove any other PHP entries.

In the IIS console at the server level open the FastCGI icon and confirm that there is only one entry there as well. Remove any other than the 5.3.8 entry. There should be only one.

At this stage the IIS console should show a PHP Manager icon in the server page. Checking the phpinfo() page will confirm that PHP is running ok.

The next bit is what caught me. It was an existing SugarCRM -> MSSQL install that was working (albeit with other issues) but I kept getting Error 500 Internal Server Errors when I tried to run the old Sugar install. Using phpinfo() pages worked so it was not a PHP issue. There was no PHP error log message, and nothing in the Event Viewer.

It was only during some testing that I tried installing a fresh copy of SugarCRM to establish if the issue was something corrupted in the existing application. The installer ran through its checks and offered for me to select the database driver. But, the only option was MySQL. That was my Duh! moment. Checking back on the PHP install and doing some extra reading confirmed that the earlier 5.2.8 install had the MS-SQL drivers while the 5.3.8 doesn’t automatically include them. You would think that a Microsoft prepared installer would have MS-SQL as a preferred database, but no it’s a separate install. Which explains the odd Internal Server Error 500 when trying to use the SugarCRM application. It could not get to the database as the PHP drivers did not exist.

Refer to the learniis page for installing the SQL Drivers but it points to v1.0 of the drivers. Use the following link for version 2.0

Downloading the Microsoft SQL Server drivers for PHP currently version 2.0.

Select the correct .dll for the installation, VC9 Non-Thread-Safe, for both the SQL and PDO_SQL (PHP Data Objects) and copy these to the PHP extensions directory C:Program Files (x86)PHPv5.3ext

Finally, using the IIS console PHP Manager at the server level, enable these additional extensions. I restarted the IIS for good measure and SugarCRM is working again.

Leave a Reply

Your email address will not be published. Required fields are marked *