View Source

<h1>Installing Zend Framework on Windows</h1>

<p>To install, <a href="http://framework.zend.com/download">download the appropriate version</a> (most users will want the &quot;Preview&quot; release) and extract the .zip file to the directory of your choosing.</p>

<p>There are currently no installers that have been created for Zend Framework.</p>

<p>For information on configuring a URL rewriting engine like Apache mod_rewrite or ISAPI_Rewrite for Microsoft IIS, see <ac:link><ri:page ri:content-title="Configuring Your URL Rewriter" /></ac:link>.</p>

<h2>Pre-built Packages </h2>

<h3>Zend Server or Zend Server Community Edition</h3>

<p>You can have Zend Framework setup on Windows by installing <a href="http://www.zend.com/en/products/server-ce/index">Zend Server Community Edition</a>, which is available for free from Zend, and includes a PHP stack as well as the latest (or close to latest) version of Zend Framework, in one quick and easy installation.</p>

<h2>Manual / Custom Installation</h2>

<h2>Preparation</h2>

<p>A minimal system for Zend framework includes PHP and a web server. Optional a database can be installed. This section includes different ways to create that environment.</p>

<h3>Way 1 (Ala Carte)</h3>

<h4>Webserver</h4>
<ul>
<li><a href="http://www.apache.org/dist/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi">Download</a> and install the latest version of Apache</li>
</ul>


<h4>Optional if you need a database</h4>
<ul>
<li><a href="http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.27-win32.msi/from/pick#mirrors">Download</a> and install the latest version of MySQL</li>
<li><a href="http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r6-win32.msi/from/pick#mirrors">Download</a> and install the MySQL administration tools
<ul>
<li>At this point it might be a good idea to verify that the MySQL installation is working by attempting to connect to it via the query browser (or whatever admin tool you decided to install), and create a simple database.</li>
</ul>
</li>
</ul>


<h4>PHP</h4>
<ul>
<li><a href="http://www.php.net/get/php-5.2.0-win32-installer.msi/from/a/mirror">Download</a> and install the latest version of PHP
<ul>
<li>The PHP installer will ask for the location of the Apache configuration directory. If Apache was installed to the default location, the configuration directory will be something like this: &quot;C:\Program Files\Apache Software Foundation\Apache2.2\conf&quot;</li>
<li>The PHP installation process will update the Apache Configuration file (httpd.conf) and the MIMES file (mime.types) with the needed directives.</li>
</ul>
</li>
</ul>


<ul>
<li>If you have installed a mysql database
<ul>
<li>Verify that there is a copy of libmysql.dll in the windows system directory, or some other directory that is in the system PATH. If needed it can be copied from the base directory of the PHP install.</li>
<li>When running the PHP installer be sure to select the modules needed for your database. For MySQL you will need to select &quot;MySQL&quot; and &quot;PDO/MySQL&quot;</li>
</ul>
</li>
</ul>


<ul>
<li>After all Restart Apache to load the new PHP settings</li>
</ul>


<p>If it went as smoothly as it did for me this is all that needs to be done. As mentioned above, the only file that might need to be moved into place manually is the libmysql.dll.</p>

<h3>Way 2 (Simple)</h3>

<ul>
<li>XAMPP <a href="http://www.apachefriends.org/de/xampp-windows.html">download here</a></li>
</ul>


<p>XAMPP is a complete package for Windows (also avaiable for Linux and Co).<br />
It has an installer with predefined configuration for a complete WebServer Environment.</p>
<ul>
<li>Apache 2.2.3</li>
<li>PHP 5.2</li>
<li>MySQL</li>
<li>Zend Optimizer</li>
<li>and a few more useful programs</li>
</ul>


<p>Once downloaded and installed the system is ready to go.</p>

<h3>Way 3 (Simple)</h3>

<ul>
<li>WAMP <a href="http://www.wampserver.com/en/download.php">download here</a></li>
</ul>


<p>WAMP is another complete package (for Windows only) which also has a tray icon that allows you to manage the services. It's a complete installer with existing configuration for an *AMP environment, plus managers for mysql and sqlite.</p>
<ul>
<li>Apache 2.0.58</li>
<li>PHP 5.1.4 + PECL</li>
<li>SQLitemanager</li>
<li>MySQL 5.0.22</li>
<li>Phpmyadmin</li>
</ul>


<p>Note: though XAMPP comes with PDO modules (Zend DBs preferred db adapters), only the sqlite and sqlite2 adapters are enabled. Modify the php.ini (C:\wamp\Apache2\bin\php.ini by default) to enable them.</p>

<h3>Way 4 (from Originals)</h3>

<ul>
<li>Apache 2.2.3 <a href="http://httpd.apache.org/download.cgi">download here</a></li>
<li>PHP 5.2.0 <a href="http://www.php.net/get/php-5.2.0-Win32.zip/from/a/mirror">download here</a></li>
</ul>


<p>Install and configure them properly so they will work together.</p>
<ul>
<li>Apache and PHP Setup <a href="http://www.apachelounge.com/forum/viewtopic.php?t=570">look here</a></li>
</ul>


<h3>Way 5 (Boosted)</h3>

<p>When you're in need of extended features from apache you might want to use this way which installs PHP 5.2 as module in Apache 2.2.3.</p>

<ul>
<li>Apache 2.2.3 with SSL and mod_deflate <a href="http://www.apachelounge.com/download/">download here</a>
<ul>
<li>Also several useful mods and extensions for Apache can be found here as
<ul>
<li>mod_security</li>
<li>mod_fcgid</li>
<li>mod_log_rotate</li>
</ul>
</li>
</ul>
</li>
<li>PHP 5.2.0 <a href="http://www.php.net/get/php-5.2.0-Win32.zip/from/a/mirror">download here</a>
<ul>
<li>Install PHP be be used as Apache 2.2.x module</li>
</ul>
</li>
<li>Optimize Apache <a href="http://www.apachelounge.com/forum/viewtopic.php?t=274">look here</a></li>
<li>Speed up PHP with APC <a href="http://www.apachelounge.com/article.php?op=Print&amp;sid=67">look here</a></li>
</ul>


<h3>Way 6 (Using Cygwin)</h3>

<p>Download and <a href="http://www.cygwin.com/">install Cygwin</a>. Select gcc, lighttpd, apache, libpcre, libjpeg, gd, zlib, libpng, sqlite, autoconf, libtool, make, etc. when choosing packages to download and install.</p>

<p>Note: If you already have installed Cygwin, make sure to first upgrade all installed packages before compiling PHP.</p>

<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ cat ./php-5.1.4/config.nice
#! /bin/sh
#
# Created by configure

CFLAGS='-Os -march=pentium-m -pipe -fomit-frame-pointer' \
'./configure' \
'--enable-fastcgi' \
'--enable-sqlite-utf8' \
'--with-pdo-sqlite=/usr/local/lib/' \
'--enable-soap' \
'--enable-sockets' \
'--with-pcre-regex=/usr/' \
'--with-jpeg-dir=/usr/lib/' \
'--with-png-dir=/usr/lib/' \
'--with-zlib-dir=/usr/lib/' \
'--with-gd' \
"$@"


$ cat ~/bin/gcc
#!/bin/bash
# These optimizations work for a Pentium-M CPU only!
exec ccache /usr/bin/gcc $* -Os -march=pentium-m -pipe -fomit-frame-pointer
]]></ac:plain-text-body></ac:macro>

<p>Add ~/bin to your PATH in ~/.bashrc.</p>

<p>Download PHP source, from www.php.net or even the latest 5.x.y from <a class="external-link" href="http://snaps.php.net">http://snaps.php.net</a>.</p>

<p>Then run ./php-5.1.4/config.nice</p>

<p>For lighttpd:</p>
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
server.modules = (
"mod_rewrite",
"mod_redirect",
"mod_alias",
"mod_access",
"mod_status",
"mod_setenv",
"mod_fastcgi",
"mod_simple_vhost",
"mod_cgi",
"mod_compress",
"mod_accesslog" )
server.document-root = "/www/pages/"
server.errorlog = "/var/log/lighttpd.error.log"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar"
)
accesslog.filename = "/www/logs/access.log"
url.access-deny = ( "~", ".inc" )
$HTTP[ZFUSER:"url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
server.port = 8080
simple-vhost.server-root = "/cygdrive/c/gavin/home/lighttpd/"
simple-vhost.default-host = "zf"
simple-vhost.document-root = "/www/"
dir-listing.activate = "enable"
compress.cache-dir = "/tmp/lighttpd/cache/compress/"
compress.filetype = ("text/plain", "text/html")
cgi.assign = ( ".php" => "/usr/local/bin/php", ".pl" => "/usr/bin/perl" )
status.status-url = "/server-status"
status.config-url = "/server-config"
url.rewrite = (
"^/status$" => "/server-status" ,
"^/config$" => "/server-config" ,
# add your redirect to your framework bootstrap below
)
setenv.add-environment = ( "TZ" => "PST8PDT" )
]]></ac:plain-text-body></ac:macro>

<h2>Test PHP</h2>

<ol>
<li>Create a simple file with the following code:
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
// file: phptest.php
<?php
phpinfo();
]]></ac:plain-text-body></ac:macro></li>
<li>Place it in your web-server root directory,</li>
<li>Enter the URL in your browser: <a class="external-link" href="http://localhost/phptest.php">http://localhost/phptest.php</a></li>
</ol>


<ul>
<li>If there is no output or an error occurred, most likely something has been configured incorrectly. Check the PHP logs and the webserver logs. The location of these log files depends on the directives in the php.ini file and the httpd.conf (for the Apache web server). Typical locations of these configuration files, and the syntax of the directives would be something like this:
<ac:macro ac:name="noformat"><ac:plain-text-body><![CDATA[
C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf

ErrorLog "C:/www/logs/error.log
AccessLog "C:/www/logs/access.log


C:/Program Files/PHP/php.ini

; Log errors to specified file.
error_log = "c:/www/logs/php.log"
]]></ac:plain-text-body></ac:macro></li>
</ul>


<h2>Rewriting URLs</h2>
<p>See <ac:link><ri:page ri:content-title="Configuring Your URL Rewriter" /></ac:link>.</p>

<h2>Install The Zend Framework</h2>

<p>Download and install the Zend_Framework</p>
<ul>
<li><a href="http://framework.zend.com/download/zip">latest official Zend_Framework here</a><br />
or play around with the</li>
<li><a href="http://framework.zend.com/wiki/display/ZFDEV/Zend+Framework+Subversion+Standards">latest Developer Version of Zend_Framework</a></li>
</ul>


<p>Hints for starting with the Zend Framework can be found here</p>
<ul>
<li><a href="http://framework.zend.com/manual">Official framework manual</a></li>
<li><a href="http://hades.phparch.com/ceres/public/article/index.php/art::zend_framework::tutorial">PHP Architect Tutorial</a></li>
<li><a href="http://wiki.cc/php/Zend_Controller">PHP Wiki</a></li>
<li><a href="http://devzone.zend.com/node/view/id/70">Zend Tips</a></li>
<li><a href="http://devzone.zend.com/public/view/tag/PHP%20Blueprint">Zend Tips 2</a></li>
</ul>


<h2>Debugging Install Issues</h2>

<h4>&quot;Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The PDO extension is required for this adapter but not loaded' in ...&quot;</h4>

<ul>
<li>Make sure that PDO is loaded in PHP. Make sure the .dll for the PDO extension is available to PHP (usually by dropping it into the 'ext' folder of your PHP installation and restarting your web server). If you don't have the PDO .dll, you can grab it off of <a href="http://pecl4win.php.net/">http://pecl4win.php.net/</a>.</li>
</ul>