Zend Framework on IIS7/Vista

At home, I do all my development on a windows vista box. Making ZFW run properly on IIS requires a little tweaking. Here are the steps (we will go through installing PHP first, then the Mysql Server and finally ZFW setup) :

1. Install/Activate IIS : Although Vista comes with IIS7, it needs to be ‘turned on’ from the ‘control panel->programs’ dialog box

2. While activating IIS, remember to check the ‘CGI’ extension. The FastCGI is activated when this done. FastCGI is installed along with the Vista SP1 autoupdate (In order to get FastCGI support on IIS7.0 in Windows Vista it is necessary to upgrade to Vista SP1). For best performance, FastCGI is the recommended way to run PHP on IIS.

image

3. Download the URL Rewrite plugin from Microsoft. This is the .htaccess equivalent in the IIS world – A vital component for the Zend Framework. For more information on importing existing htaccess files into IIS, please refer to this thread

4. Download PHP – the ‘non thread-safe’ version. FastCGI automatically handles threading issues so it is advised you get the leaner, non-thread safe package. Unzip this to a location on your hard drive (I put mine in c:\php)

5. Open IIS manager and tell IIS to associate all .php files with the php executable via the FastCGI plugin

  • Open IIS manager
  • click on ‘Handler Mappings’
  • Click on ‘Add Module Mapping’
  • Key in the following settings:

image

6. Download MySql database for windows. Get the MSI version.. Accept defaults. You may also want to download a good client (like SQLYog-community edition) to interact with your database.

7. Make changes to php.ini to include the Mysql Library. Un-comment the following lines (If they don’t exist, append them)

fastcgi.impersonate = 1

extension=php_mysql.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_ldap.dll

The extension_dir directive tells php the location of the various dlls. Make sure that all referenced dlls do exist in the folder. For instance, my extension_dir looks like:

extension_dir =”C:\php\ext”

and the ext folder contains all my php dlls’

Change your session.save_path to indicate a writeable directory that IIS could use for example:
session.save_path = “C:\web\session”

8. Restart IIS.. Go into the IIS administrator, setup a virtual directory and then verify that your new server integrates well with php using a simple phpinfo() script. Also ensure that the mysql database libraries are loaded successfully (displayed in the output of phpinfo())

9. Download the most recent version of Zend Framework  (version 1.7 as of this writing)

10. Modify your php.ini to include the Zend framework library in the include path like so:

include_path=”.;C:\php\includes;C:\ZendFramework-1.7.4\library”

Restart IIS one more time. Now, you are ready to test whether ZFW runs as expected on your system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s