Need to install PHP on your local environment to mimic as close as possible to Azure? This guide will show you how to install IIS 7.5 with PHP on a Windows 7 machine. Do note that Azure is running IIS 8.0 but I don’t think the difference is that big. Plus IIS 7.5 comes baked with Windows 7.
- Follow these steps first to activate IIS. http://technet.microsoft.com/en-us/library/cc725762.aspx
- Then open your browser and type in localhost You should then see an IIS splash screen.
- Easiest way to install PHP is to go to : http://www.microsoft.com/web/downloads/platform.aspx and install Microsoft Web Platform Installer 5.0
- Download it, install it and select PHP 5.4.29. Azure runs 5.4.23, but this is close enough.
- Now that PHP should be installed on your IIS with all the configuration set. Go to: http://technet.microsoft.com/en-us/library/hh994592.aspx and go to step To test your PHP Installation
- I’ve made the following edits to my PHP.ini.
extension_dir = “C:PHPext”
date.timezone = America/Chicago
short_open_tag: On
The following are optional things I turned on to mimic my previous WAMP default install. You could just copy and paste the following lines into PHP.ini.
extension=php_bz2.dll
extension=php_curl.dll
extension=php_com_dotnet.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
- Goto http://www.microsoft.com/en-us/download/details.aspx?id=20098 and download SQLSRV30.exe. Per http://php.net/manual/en/sqlsrv.requirements.php you should select Non-Thread safe.
- Extract to your PHP EXT folder. Should be C:PHPext
- Add the following to your PHP extension
extension=php_sqlsrv_54_nts.dll
extension=php_pdo_sqlsrv_54_nts.dll
- Then you can reboot the server. START -> Internet Information Service Manager -> Manager Server -> Reset or Start -> CMD -> iisreset
- I’ve attached a simple SQL script. Put this in your localhost directory C:inetpubwwwroot and then go to your browser and type localhost/db.php
That’s it! It “SHOULD” run ok.
PROTIP!
This is a nice install to have so you can do easy configs within the IIS Manager.