Apache problems after upgrading to Yosemite

17,984

Solution 1

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

Solution 2

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

Solution 3

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

Solution 4

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.

Share:
17,984

Related videos on Youtube

Tom Oakley
Author by

Tom Oakley

I am a Software Developer, currently focussing on React Native development at TotallyMoney. I have experience with many facets of JavaScript, including Node.js and ES6, frameworks including React (and Redux, Flow and Styled Components) and Angular (2+, TypeScript). I have used build systems including Webpack, Gulp and Grunt. I practice test-driven development and have used many testing frameworks including Jasmine, Mocha, Chai, Jest (for React) and utilise test coverage reports produced by Instanbul/Karma. I also use functional JavaScript libraries including Ramda and Lodash. In terms of front-end development, I also have extensive experience with CSS(3) and use Sass or PostCSS as a pre-processor to write my CSS code. I have extensive experience with HTML5. I am extremely comfortable working with all manor of APIs for different services and I know the principles behind what makes a good ReSTful API and have also explored Facebook's GraphQL model for APIs. Git and version control is a natural part of my workflow and have used this for many years. I also know about PHP and WordPress development, having WP development for a number of years. I am confident using SQL and associated database types including Postgres and SQLite3, and also NoSQL solutions such as MongoDB and Key-Value stores such as Redis. I have experience with DevOps and deployment including Continous Integration services such as Jenkins and Travis and am comfortable using Amazon Web Services and Digital Ocean, and using Bash scripting on the command line. Currently not open to new opportunities.

Updated on September 18, 2022

Comments

  • Tom Oakley
    Tom Oakley almost 2 years

    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.

  • Matthieu Riegler
    Matthieu Riegler over 9 years
    This did it for me !
  • AlxVallejo
    AlxVallejo over 8 years
    How does that answer the question? You shouldn't have to change what php module you're loading after upgrading Apache...