if you can’t load/find phpapache2.dll

Posted by – July 7, 2008

If you are trying to do what I did, install PHP5 and Apache 2 on Windows XP machine using an Apache installer and a zipped PHP, then you are bound to see these messages
HTTPD: Syntax error on line 485 of C:/amp/apache2/conf/httpd.conf: Cannot load C:/amp/apache2/php5apache2.dll into server: The specified module could not be found.

The solution is to add this to your file

#load the php main library to avoid dll hell
Loadfile "C:\pathtophp\php5ts.dll"

#load the sapi so that apache can use php
LoadModule php5_module “C:\pathtophp\php5apache2_2.dll”

#set the php.ini location so that you don’t have to waste time guessing where it is
PHPIniDir “C:\pathtophp”

#Hook the php file extensions, notice that Addtype is NOT USED, since that’s just stupid
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps

More on this page.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>