I had an existing Amazon Linux EC2 instance running Apache 2.2 and PHP 5.3. After uninstalling the old versions of Apache PHP using (sudo yum remove 'php*' 'httpd*'
), I then installed Apache 2.4 and PHP 7.1.
However, I am now unable to start Apache. It simply fails to start without returning any errors:
[ec2-user@srv ~]$ sudo service httpd start
Starting httpd: [FAILED]
I have checked the error logs at /var/log/httpd/
- nothing.
I have checked the system error logs at /var/log/messages
- nothing.
I have tried starting Apache using httpd -e debug
but there are no errors shown. All this command outputs is a list of modules being loaded, and then nothing:
[ec2-user@srv ~]$ sudo httpd -e debug
[Wed Dec 06 15:27:05.088704 2017] [so:debug] [pid 12707] mod_so.c(266): AH01575: loaded module access_compat_module from /etc/httpd/modules/mod_access_compat.so
[Wed Dec 06 15:27:05.088924 2017] [so:debug] [pid 12707] mod_so.c(266): AH01575: loaded module actions_module from /etc/httpd/modules/mod_actions.so
(...)
[Wed Dec 06 15:27:05.107018 2017] [so:debug] [pid 12707] mod_so.c(266): AH01575: loaded module ssl_module from /etc/httpd/modules/mod_ssl.so
[Wed Dec 06 15:27:05.113433 2017] [so:debug] [pid 12707] mod_so.c(266): AH01575: loaded module php7_module from /etc/httpd/modules/libphp-7.1.so
[ec2-user@srv ~]$
And still, Apache is not running:
[ec2-user@srv ~]$ sudo service httpd status
httpd is stopped
I have tried disabling the libphp-7.1
module, and then I get a different debug error:
AH00526: Syntax error on line 11 of /etc/httpd/conf.d/nbn-raw.conf:
Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
Which makes sense, because PHP is then not being loaded. So I suspect it is related to PHP 7.1.
The contents of /etc/httpd/conf.d/nbn-raw.conf
:
Alias /nbn/ /var/www/html/nbn/
<Directory "/var/www/html/nbn">
# allow .htaccess to do rewrites
AllowOverride FileInfo AuthConfig Limit
Options FollowSymLinks
Order allow,deny
Allow from all
php_value include_path ".:/usr/share/pear:/usr/share/php:/var/www/html/nbn/rtc/lib/Pheanstalk:/var/www/html/nbn/rtc/lib"
</Directory>
I have also checked the syntax of the apache conf files in the /etc/httpd/conf.d
directory, but there are no errors returned there either:
[ec2-user@srv ~]$ apachectl configtest
Syntax OK
Can anyone help me with this issue?
Can anyone suggest anything I might have missed, or any additional log files I could check?