apache restart error Segmentation fault: 11 $HTTPD "$@"
apache, apache2, macos, mysql, php
Solution
The "Segmentation fault" error when starting Apache occurs because Apache tries to load both the old and the new version of php at the same time. Looking at these instructions: https://coolestguidesontheplanet.com/upgrade-php-on-osx/ , the installation script creates a file that loads the new php 7 version in
/etc/apache2/other/+php-osx.conf
The script is also supposed to disable the loading of the old php version by, in the apache configuration file,
/etc/apache2/httpd.conf
commenting out this line:
#LoadModule php5_module libexec/apache2/libphp5.so
but it didn't do that for me. As soon as I commented it out manually, Apache started again using
sudo apachectl -k restart
Problem
I'm new to web development and wanted to create my own local server on mac os Sierra in order to do some development. I've followed a (few) tutorials on getting apache , php and mysql up and running, and have only made it to the php part ,which is where I am failing at the moment. I managed to access localhost via http://localhost/~username and found my directory there, however once I uncomment the php LoadModule in the httpd.conf my ability to access localhost fails and I am thrown with the error `ERR_CONNECTION_REFUSED`. This is after I tried to restart apache using ``` sudo apachectl -k restart ``` Which threw this error: httpd not running, trying to start /usr/sbin/apachectl: line 92: 11399 Segmentation fault: 11 $HTTPD "$@" The error logs from `tail -f /var/log/apache2/error_log`, had the following to say: AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist [Mon May 01 19:33:52.138346 2017] [mpm_prefork:notice] [pid 3454] AH00163: Apache/2.4.23 (Unix) PHP/7.1.1 configured -- resuming normal operations [Mon May 01 19:33:52.138434 2017] [core:notice] [pid 3454] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Mon May 01 19:37:22.694456 2017] [mpm_prefork:notice] [pid 3454] AH00169: caught SIGTERM, shutting down AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist [Mon May 01 19:53:54.632167 2017] [mpm_prefork:notice] [pid 4059] AH00163: Apache/2.4.23 (Unix) PHP/7.1.1 configured -- resuming normal operations [Mon May 01 19:53:54.632251 2017] [core:notice] [pid 4059] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Mon May 01 20:04:26.379765 2017] [mpm_prefork:notice] [pid 4059] AH00169: caught SIGTERM, shutting down I've spent several hours looking at similar topics on stackoverflow as well as other sources but to no avail. I am fairly new to all of this as well and thus I'm not overly clued up on a lot of the terminology. From my understanding (whatever little it may be), it may be something to do with a bad module or php7 not linking up properly ? I am using apache version: ``` Server version: Apache/2.4.23 (Unix) Server built: Aug 8 2016 16:31:34 php version 7.1.1 ``` and configtest gives me the following: AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist Syntax OK Any advice would greatly be appreciated. Completely gassed out on what to do next :(