XAMPP: how to configure Apache for PHP
October 15, 2010 4:02 PM   Subscribe

I'm using XAMPP, but my PHP isn't working. I think it's an issue with Apache. How do I reconfigure it so it actually recognizes my PHP?

My XAMPP is not reading my PHP. Probably, there's a problem with my Apache configuration. My PHP book suggested that I open the httpd configuration file and add these lines:

LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php .php

Which I did, but when I went back to the control panel to turn Apache back on, I couldn't get the running sign by it. I figured that this was because my PHP book doesn't think I'm using XAMPP. I tried the following instead:

LoadModule php5_module c:/xampp/php/php5apache2_2.dll
PHPIniDir "c:/xampp/php/"
AddType application/x-httpd-php .php

But the problem isn't solved (PHP still doesn't work, I can't get the running sign by Apache in the control panel). What should I do? I'm using Windows 7, if it matters.
posted by randomname25 to Computers & Internet (13 answers total)
 
Check the error log—  there's something Apache doesn't like about those directives, and it will tell you in detail if you read the log. The log file is presumably under /xampp somewhere; you can just go look for it, or read through the config file for the log directives.
posted by hattifattener at 4:59 PM on October 15, 2010


Shot in the dark but in the httpd.comf file, what is the port? Are you developing any Windows applications that might have port 80, such that Apache can't start? I've never done XAMPP on Win 7, but have on earlier versions. - I am wondering if Windows firewall, or UAC might be preventing Apache from starting up.

Apache Friends has special instructions for Vista, and it looks like it doesn't mention Win 7 at all, however might be a similar situation. link.
posted by xetere at 5:00 PM on October 15, 2010


Response by poster: OK, so I uninstalled and reinstalled XAMPP. Then I checked the error log for Apache and got this:

[Tue Oct 12 16:46:04 2010] [notice] Digest: generating secret for digest authentication ...
[Tue Oct 12 16:46:04 2010] [notice] Digest: done
[Tue Oct 12 16:46:05 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Oct 12 16:46:05 2010] [notice] Server built: Nov 11 2009 14:29:03
[Tue Oct 12 16:46:05 2010] [notice] Parent: Created child process 5072
[Tue Oct 12 16:46:08 2010] [notice] Digest: generating secret for digest authentication ...
[Tue Oct 12 16:46:08 2010] [notice] Digest: done
[Tue Oct 12 16:46:08 2010] [notice] Child 5072: Child process is running
[Tue Oct 12 16:46:09 2010] [notice] Child 5072: Acquired the start mutex.
[Tue Oct 12 16:46:09 2010] [notice] Child 5072: Starting 150 worker threads.
[Tue Oct 12 16:46:09 2010] [notice] Child 5072: Starting thread to listen on port 443.
[Tue Oct 12 16:46:09 2010] [notice] Child 5072: Starting thread to listen on port 80.
[Tue Oct 12 22:46:08 2010] [notice] Parent: child process exited with status 1073807364 -- Restarting.
[Thu Oct 14 19:22:38 2010] [warn] pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Oct 14 19:22:40 2010] [notice] Digest: generating secret for digest authentication ...
[Thu Oct 14 19:22:40 2010] [notice] Digest: done
[Thu Oct 14 19:22:41 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu Oct 14 19:22:41 2010] [notice] Server built: Nov 11 2009 14:29:03
[Thu Oct 14 19:22:41 2010] [notice] Parent: Created child process 3876
[Thu Oct 14 19:22:44 2010] [notice] Digest: generating secret for digest authentication ...
[Thu Oct 14 19:22:44 2010] [notice] Digest: done
[Thu Oct 14 19:22:45 2010] [notice] Child 3876: Child process is running
[Thu Oct 14 19:22:45 2010] [notice] Child 3876: Acquired the start mutex.
[Thu Oct 14 19:22:45 2010] [notice] Child 3876: Starting 150 worker threads.
[Thu Oct 14 19:22:45 2010] [notice] Child 3876: Starting thread to listen on port 443.
[Thu Oct 14 19:22:45 2010] [notice] Child 3876: Starting thread to listen on port 80.
[Thu Oct 14 20:02:45 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/scrape
[Thu Oct 14 20:03:01 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:04:02 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/scrape
[Thu Oct 14 20:04:52 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:05:47 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:13:29 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:33:05 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:34:41 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 20:43:35 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:03:09 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:04:47 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:13:41 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:33:10 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:34:58 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 21:38:12 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/favicon.ico
[Thu Oct 14 21:38:14 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/favicon.ico
[Thu Oct 14 21:44:13 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:03:14 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:05:04 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:14:19 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:33:18 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:35:10 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 22:42:50 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/favicon.ico
[Thu Oct 14 22:42:52 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/favicon.ico
[Thu Oct 14 22:44:46 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 23:03:22 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 23:05:16 2010] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/announce
[Thu Oct 14 23:12:13 2010] [notice] Parent: child process exited with status 1073807364 -- Restarting.
[Fri Oct 15 14:31:56 2010] [warn] pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Oct 15 14:31:57 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 14:31:57 2010] [notice] Digest: done
[Fri Oct 15 14:31:58 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 14:31:58 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 14:31:58 2010] [notice] Parent: Created child process 1612
[Fri Oct 15 14:32:01 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 14:32:01 2010] [notice] Digest: done
[Fri Oct 15 14:32:02 2010] [notice] Child 1612: Child process is running
[Fri Oct 15 14:32:03 2010] [notice] Child 1612: Acquired the start mutex.
[Fri Oct 15 14:32:03 2010] [notice] Child 1612: Starting 150 worker threads.
[Fri Oct 15 14:32:03 2010] [notice] Child 1612: Starting thread to listen on port 443.
[Fri Oct 15 14:32:03 2010] [notice] Child 1612: Starting thread to listen on port 80.
[Fri Oct 15 14:43:48 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 15 14:43:48 2010] [notice] Child 1612: Exit event signaled. Child process is ending.
[Fri Oct 15 14:43:49 2010] [notice] Child 1612: Released the start mutex
[Fri Oct 15 14:43:50 2010] [notice] Child 1612: All worker threads have exited.
[Fri Oct 15 14:43:50 2010] [notice] Child 1612: Child process is exiting
[Fri Oct 15 14:43:50 2010] [notice] Parent: Child process exited successfully.
[Fri Oct 15 14:43:57 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 14:43:57 2010] [notice] Digest: done
[Fri Oct 15 14:43:58 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 14:43:58 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 14:43:58 2010] [notice] Parent: Created child process 3316
[Fri Oct 15 14:44:01 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 14:44:01 2010] [notice] Digest: done
[Fri Oct 15 14:44:02 2010] [notice] Child 3316: Child process is running
[Fri Oct 15 14:44:02 2010] [notice] Child 3316: Acquired the start mutex.
[Fri Oct 15 14:44:02 2010] [notice] Child 3316: Starting 150 worker threads.
[Fri Oct 15 14:44:02 2010] [notice] Child 3316: Starting thread to listen on port 443.
[Fri Oct 15 14:44:02 2010] [notice] Child 3316: Starting thread to listen on port 80.
[Fri Oct 15 17:06:35 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 15 17:06:35 2010] [notice] Child 3316: Exit event signaled. Child process is ending.
[Fri Oct 15 17:06:36 2010] [notice] Child 3316: Released the start mutex
[Fri Oct 15 17:06:37 2010] [notice] Child 3316: All worker threads have exited.
[Fri Oct 15 17:06:37 2010] [notice] Child 3316: Child process is exiting
[Fri Oct 15 17:06:37 2010] [notice] Parent: Child process exited successfully.
httpd.exe: Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
httpd.exe: Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
httpd.exe: Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/php/php5apache2_2.dll into server: The specified module could not be found.
httpd.exe: Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/php/php5apache2_2.dll into server: The specified module could not be found.
[Fri Oct 15 19:08:09 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:08:09 2010] [notice] Digest: done
[Fri Oct 15 19:08:10 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 19:08:10 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 19:08:10 2010] [notice] Parent: Created child process 5080
[Fri Oct 15 19:08:13 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:08:13 2010] [notice] Digest: done
[Fri Oct 15 19:08:14 2010] [notice] Child 5080: Child process is running
[Fri Oct 15 19:08:14 2010] [notice] Child 5080: Acquired the start mutex.
[Fri Oct 15 19:08:14 2010] [notice] Child 5080: Starting 150 worker threads.
[Fri Oct 15 19:08:14 2010] [notice] Child 5080: Starting thread to listen on port 443.
[Fri Oct 15 19:08:14 2010] [notice] Child 5080: Starting thread to listen on port 80.

Dunno what to make of that, and apparently it's saved error logs since before I uninstalled the thing.

If it's not obvious I don't know squat about servers. I just want to set up this local thing to test out my dynamic pages and then I'll be in heaven.

Should I just use a different WAMP or something? I've been tearing my hair out over this all day and haven't gotten anywhere.
posted by randomname25 at 5:16 PM on October 15, 2010


Uninstall it, delete the xampp directory entirely, then reinstall it and post the error log.
posted by Jairus at 5:23 PM on October 15, 2010


Response by poster: I followed your advice, Jairus. Here's what I got:

[Fri Oct 15 19:44:00 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:00 2010] [notice] Digest: done
[Fri Oct 15 19:44:00 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 19:44:00 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 19:44:00 2010] [notice] Parent: Created child process 912
[Fri Oct 15 19:44:03 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:03 2010] [notice] Digest: done
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Child process is running
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Acquired the start mutex.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting 150 worker threads.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 443.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 80.
posted by randomname25 at 5:46 PM on October 15, 2010


It works out of the box for me, you don't need to add anything.

Make sure your PHP code is opened with <?php instead of just <?

You used to be able to get away with the short version. I don't recall the specifics, but generally modern configurations require the full open tag. Your book may be somewhat out of date.
posted by hungrysquirrels at 6:04 PM on October 15, 2010


Response by poster: I'm opening with <?php. It's not working.
posted by randomname25 at 6:06 PM on October 15, 2010


Best answer: Oh, and if you're still having issues, and don't need all the extras, just Apache, PHP, MySQL, then WampServer is a bit more lightweight and works fine as a development server.
posted by hungrysquirrels at 6:06 PM on October 15, 2010


So how did you install xampp? It usually installs php without any additional downloading or installing. Looking through the logs you posted, the line
[Fri Oct 15 19:44:00 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
seems to imply that it is indeed running php. What are you doing to test if it works? Can you see files in the same directories if they aren't php files? What happens when you request a php file?
posted by advicepig at 6:41 PM on October 15, 2010


Seconding advicepig - what happens when you try to hit http://mysever/testfile.php - do you get the raw text of the file, an error message, or nothing?
posted by Old'n'Busted at 6:43 PM on October 15, 2010


Response by poster: <?php

echo "Hello World";

?>

I also called the PHP info function.

Seeing that I don't need all the fancy XAMPP extras, I uninstalled it for the fifth time, but this time installed WampServer instead per the suggestion of hungry squirrels. Which... won't launch at all. I rebooted and still I get no error messages and the task manager doesn't indicate that I've clicked anything. I'm running SpyBot now because I'm starting to expect that something weird's going on with my computer.
posted by randomname25 at 7:21 PM on October 15, 2010


Response by poster: I got WampServer running, and uploaded my PHP page. It works! I'm so happy~

Thanks for the suggestion, hungry squirrels (and thanks, everyone else, for trying!).
posted by randomname25 at 7:45 PM on October 15, 2010


Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/php/php5apache2_2.dll into server: The specified module could not be found.
Syntax error on line 116 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/php/php5apache2_2.dll into server: The specified module could not be found.


I submit to you that the error you seek is precisely that as highlighted above. Have a look in that directory and confirm that the required dll is indeed present and correct.
posted by Biru at 6:48 AM on October 16, 2010


« Older I have defeated your pathetic catnip mouse army...   |   Perfectly fine or tragically misguided cookware... Newer »
This thread is closed to new comments.