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.

Django Reinhardt
  • 2,286
  • 3
  • 38
  • 58

1 Answers1

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.

Django Reinhardt
  • 2,286
  • 3
  • 38
  • 58