Apache22 won't start

Hi,

I'm having trouble getting Apache22 to work. So far I can say PHP5 seems to cause the trouble. Only I can't figure out what the problem is.

When I start apache, it says all is ok. But when I check with sockstat -4, nothing is listening on port 80.

When I disable this line in httpd.conf, Apache runs fine.
Code:
LoadModule php5_module libexec/apache22/libphp5.so

This is a strange one. When I compile php5 with debug enabled, it also runs fine. That is, apache22 does start, but PHP5 doesn't work.

I tried to set apache's LogLevel to debug, to figure out what goes wrong. But I can't find anything. :(
 
I did, but that didn't give me much to go on. But now I have PHP5 compiled with debug support, it's coughing up something interresting. Only I don't really understand why it produces these errors :\

Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/bz2.so' - Cannot open "/usr/local/lib/php/20090626-debug/bz2.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/calendar.so' - Cannot open "/usr/local/lib/php/20090626-debug/calendar.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/ctype.so' - Cannot open "/usr/local/lib/php/20090626-debug/ctype.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/curl.so' - Cannot open "/usr/local/lib/php/20090626-debug/curl.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/dom.so' - Cannot open "/usr/local/lib/php/20090626-debug/dom.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/fileinfo.so' - Cannot open "/usr/local/lib/php/20090626-debug/fileinfo.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/filter.so' - Cannot open "/usr/local/lib/php/20090626-debug/filter.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/gd.so' - Cannot open "/usr/local/lib/php/20090626-debug/gd.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/gettext.so' - Cannot open "/usr/local/lib/php/20090626-debug/gettext.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/gmp.so' - Cannot open "/usr/local/lib/php/20090626-debug/gmp.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/hash.so' - Cannot open "/usr/local/lib/php/20090626-debug/hash.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/iconv.so' - Cannot open "/usr/local/lib/php/20090626-debug/iconv.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/imap.so' - Cannot open "/usr/local/lib/php/20090626-debug/imap.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/json.so' - Cannot open "/usr/local/lib/php/20090626-debug/json.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/ldap.so' - Cannot open "/usr/local/lib/php/20090626-debug/ldap.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/mbstring.so' - Cannot open "/usr/local/lib/php/20090626-debug/mbstring.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/mcrypt.so' - Cannot open "/usr/local/lib/php/20090626-debug/mcrypt.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/mysql.so' - Cannot open "/usr/local/lib/php/20090626-debug/mysql.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/mysqli.so' - Cannot open "/usr/local/lib/php/20090626-debug/mysqli.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/openssl.so' - Cannot open "/usr/local/lib/php/20090626-debug/openssl.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/pdf.so' - Cannot open "/usr/local/lib/php/20090626-debug/pdf.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/pdo.so' - Cannot open "/usr/local/lib/php/20090626-debug/pdo.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/pdo_sqlite.so' - Cannot open "/usr/local/lib/php/20090626-debug/pdo_sqlite.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/pgsql.so' - Cannot open "/usr/local/lib/php/20090626-debug/pgsql.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/phar.so' - Cannot open "/usr/local/lib/php/20090626-debug/phar.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/posix.so' - Cannot open "/usr/local/lib/php/20090626-debug/posix.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/readline.so' - Cannot open "/usr/local/lib/php/20090626-debug/readline.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/recode.so' - Cannot open "/usr/local/lib/php/20090626-debug/recode.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/session.so' - Cannot open "/usr/local/lib/php/20090626-debug/session.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/simplexml.so' - Cannot open "/usr/local/lib/php/20090626-debug/simplexml.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/snmp.so' - Cannot open "/usr/local/lib/php/20090626-debug/snmp.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/soap.so' - Cannot open "/usr/local/lib/php/20090626-debug/soap.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/sockets.so' - Cannot open "/usr/local/lib/php/20090626-debug/sockets.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/sqlite.so' - Cannot open "/usr/local/lib/php/20090626-debug/sqlite.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/sqlite3.so' - Cannot open "/usr/local/lib/php/20090626-debug/sqlite3.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/tokenizer.so' - Cannot open "/usr/local/lib/php/20090626-debug/tokenizer.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/xml.so' - Cannot open "/usr/local/lib/php/20090626-debug/xml.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/xmlreader.so' - Cannot open "/usr/local/lib/php/20090626-debug/xmlreader.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/xmlwriter.so' - Cannot open "/usr/local/lib/php/20090626-debug/xmlwriter.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/zip.so' - Cannot open "/usr/local/lib/php/20090626-debug/zip.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/zlib.so' - Cannot open "/usr/local/lib/php/20090626-debug/zlib.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626-debug/apc.so' - Cannot open "/usr/local/lib/php/20090626-debug/apc.so" in Unknown on line 0
 
My suggestion is to uninstall php5 and apache_php5 module.

My question is this: Did you download and install PHP5 and not just Apache's PHP5 module? Apache server uses a PHP5 module but still needs PHP5 installed. Also check to see those data paths and see if those files exist.

From the errors I see... it seems like it's failing to find those files. Therefor either you didn't install PHP5 and just installed Apache's PHP5 module or the files were installed or put somewhere else. The error that it spit out simply says that it can't load the PHP library saying that all files can't be found at such and such place.

I can't actually help you out there. Just giving my opinion/advice based on what you've shown so far.

Hope this helped any.
 
Leave PHP out of it, for the time being. Make sure Apache is working correctly, then move on to PHP.

If I remember correctly only two lines need to be added to httpd.conf to get PHP working.
 
I did, when I disable those two lines in httpd.conf, apache runs just fine. As soon as I enable PHP, the trouble begins.
 
I bet PHP extensions are still ending up in:

/usr/local/lib/php/20090626/

instead of:

/usr/local/lib/php/20090626-debug/

even though you have
Code:
WITH_DEBUG=true
in lang/php5?

I'm facing a similar problem - I don't know the answer.
 
I ended up destroying the entire install, So I did a clean reinstall of FreeBSD. I installed named and that went well. Installed Apache22 and that went well too. Installed php5 and ran into the same problem. I simply can't get php5 to work and I can't figure out what's going wrong :'‑(

During the compilation php5 complained about an old version of devel/pcre. I fixed that with portupgrade devel/pcre. After that php5 would compile fine.
 
Sounds like you installed a bunch of stuff before updating the ports tree. When the ports tree is installed from the installer, it is what was current when that release came out and should be immediately upgraded.

Also, before installing or upgrading anything, it's important to read /usr/ports/UPDATING. There's a recent note in there about pcre. Just rebuilding that port alone is not enough.
 
So I did a clean FreeBSD9 install. I installed www/apache22, lang/php5 and lang/php5-extensions. And PHP still doesn't work! However, Apache does start and seems to run fine, even with PHP enabled and no debug compiled. So there is some progress! :\

I have this in httpd.conf
Code:
LoadModule php5_module        libexec/apache22/libphp5.so
AddType applications/x-http-php .php
AddType applications/x-http-php-source .phps

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
The problem is that php files are downloaded as if it where text-files. And phpcode in html-files is ignored and not displayed. I can't find anything strange in the logfiles. libexec/apache22/libphp5.so does exist. Everything seems fine, exept that it doesn't work.

How should I proceed to figure out what's wrong and finally solve this problem? :(

Edit: When I run this on the commandline php /usr/local/www/apache22/data/index.php, it spits out the expected result (phpinfo() and some echo'd text). So PHP seems to work fine, as does Apache. It's combining the two that's keeping me awake at night :(
 
That's it! You are a lifesaver! :beergrin

It's always the small errors that cause the mayor problems ;)
 
Back
Top