1

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?

nevada_scout
  • 164
  • 1
  • 9
  • What in the /etc/httpd/conf.d/nbn-raw.conf and what distro are you using? – ALex_hha Dec 06 '17 at 16:32
  • @ALex_hha I have added the contents of the nbn-raw.conf file to the question, and I am using Amazon Linux 2017.09 (it's basically CentOS) – nevada_scout Dec 06 '17 at 16:40
  • And how did you install apache 2.4 and php7.1? Did you use some 3rd party repository? If so - please specify which one – ALex_hha Dec 06 '17 at 16:44
  • I installed them using the following command: `yum install php71 php71-pdo mysql php71-mbstring php71-mcrypt php71-soap php71-gd php71-pecl-memcached php71-mysqlnd php7-pear php71-gmp`. They are supplied directly from the Amazon yum repository. httpd24 is not explictly included here, but it is a dependency of one of the php packages and therefore is installed automatically – nevada_scout Dec 06 '17 at 16:45
  • 2
    Try to start apache like the following ```bash -x /etc/init.d/httpd start```. And attach to the question output of the following commands ```$ apachectl -t -D DUMP_INCLUDES``` ```$ apachectl -t -D DUMP_MODULES``` ```$ apachectl -t -D DUMP_RUN_CFG``` . Also you can try to use more verbose level, for e.g. ```# httpd -e trace5 -X``` if it doesn't help too - the next step strace :) – ALex_hha Dec 06 '17 at 17:43
  • Amazon Linux is not basically CentOS anymore. It was forked off years ago and has diverged so far that they aren't really compatible anymore. It's also not a very stable distribution, and is rarely suitable for anything. I have no idea why Amazon keeps putting effort into it. – Michael Hampton Dec 06 '17 at 20:57

0 Answers0