1

NOTE: This is not a duplicate of, nor is the answer here: Apache is not interpreting .PHP files


On my local Apache webserver, and I have PHP 5.6 and 7.0 installed. When I run 7.0 the scripts are not executed (just raw text is displayed), but when I switch to PHP 5.6 everything is fine.

I've checked my httpd.conf when running 7.0, and it's correct:

LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so

Typing php --ini in terminal produces the following:

Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File:         /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini

Which looks correct.

Typing apachectl -v produces:

Server version: Apache/2.4.18 (Unix)
Server built:   Feb 20 2016 20:03:19

I feel like it's an issue with my Apache config.

3
  • @Iain Please read the entire post, not just the subject line. It's a different issue. Jun 29, 2016 at 10:47
  • It is the same issue, it also has the same solution.
    – user9517
    Jun 29, 2016 at 11:15
  • @Iain Did you link to the wrong question by mistake? There is no accepted solution on that page, and there is no unaccepted solution on that page that solves the issue I had, either. Jun 29, 2016 at 14:38

1 Answer 1

0

Aha! It looks like httpd.conf was missing an important line:

AddType application/x-httpd-php .php

For some reason it didn't cause problems with PHP 5.6, but it not being there caused problems with PHP 7.0. Strange.

2
  • If you had used search (above right) you would find that this is a duplicate multiple times over.
    – user9517
    Jun 29, 2016 at 10:34
  • @Iain I did that, there is not a duplicate of this issue (earlier version of PHP executing scripts fine, current version not). Jun 29, 2016 at 10:51

Not the answer you're looking for? Browse other questions tagged .