8

My Mac web server won't work after upgrading to Yosemite. When I type apachectl into Terminal, I get this:

httpd: Syntax error on line 527 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _unixd_config\n  Referenced from: /usr/local/php5/libphp5.so\n  Expected in: /usr/sbin/httpd\n in /usr/local/php5/libphp5.so

If I type sudo apachectl [re]start nothing happens, as if it's started and I type it again, it says it's already running. Also, I have the Web Sharing Preference pane installed (http://clickontyler.com/web-sharing/) and when I flick the switch from Off to On, it still says it's off, even though the switch is at the On position.

What files do you guys want/need to see? Really need to fix this ASAP.

6

Please also note that the Yosemite installer overwrites the entire /private/etc/apache2/httpd.conf file with the new default Apache 2.4 configuration file.

For example, if any Listen directives were added, they will have disappeared and need to be added again. E.g.:

Listen 127.0.0.1:81

I found my old configuration in the following file, but due to differences from 2.2, it should probably not be copied directly over the http.conf file:

/private/etc/apache2/httpd.conf~previous

There is an upgrade guide at: http://httpd.apache.org/docs/2.4/upgrading.html

Make sure that any previously included extra config files are still included, and then test the configuration with the command:

sudo apachectl configtest
  • How does that answer the question? You shouldn't have to change what php module you're loading after upgrading Apache... – AlxVallejo Dec 4 '15 at 14:51
8

The problem occurs because Yosemite installs the latest version of Apache (2.4) whereas earlier versions of Mac OS X used Apache version 2.2

From the error, it appears that you were not using the standard version of PHP provided by Apple but a different version supplied by liip.ch. Removing the # sign as suggested by Nuttyx above will load the Apple version of php (5.5.14). If you wish to continue running the version supplied by liip you will need to reinstall it so that it loads properly in Apache 2.4. See a detailed explanation here: (http://blog.liip.ch/archive/2014/06/11/php-osx-available-for-os-x-10-10-yosemite.html)

N.B. If you are using virtual hosts you will probably need to change your configuration files somewhat. In particular you will need to change the following:

2.2 configuration:

Order allow,deny
Allow from all

2.4 configuration:

Require all granted
4

It seems that you can fix this by removing the # at the beggining of the following line in /etc/apache2/httpd.conf file:

LoadModule php5_module libexec/apache2/libphp5.so
1

Running 'sudo apachectl' without arguments shows the problem in the conf files. In my case upgrading php did fixed it.

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

After that, Apache run again but I had to reconfigure the vhosts.

0

While the above question has been answered, there is another possibility of the same error like:

/private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_XYZ.so into server: dlopen(/usr/libexec/apache2/mod_XYZ.so, 10): image not found

This could happen if you have created a symbolic link that is being referred in the name above and it is not found. To resolve create a symbolic link providing the absolute path for the actual file and the same for the symlink file name being provided.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.