1

I've recently had difficulties with Apache not processing PHP files on my Mac after upgrading to macOS Sierra. Original post about it is here.

The way in which I "fixed" this problem was to add the following to /etc/apache2/httpd.conf

AddType application/x-httpd-php .php

I then restarted Apache sudo apachectl restart and my PHP scripts were processed.

However, when I run a phpinfo() script it's saying PHP Version 5.6.24

When I run PHP from a command line, it's reporting PHP 7.0.10 (which is what I expect and want).

It gets stranger because I don't know where PHP 5.6.24 even exists on my system. If I run

which php

It gives:

/usr/local/php5/bin/php

But examining this further, that appears to be a symbolic link to PHP 7:

$ cd /usr/local
$ ls -l
lrwxr-xr-x 1 root  wheel 38 14 Sep 11:18 php5 -> /usr/local/php5-7.0.10-20160831-102733

Executing PHP directly from /usr/local/php5-7.0.10-20160831-102733 also reports PHP 7:

$ pwd
/usr/local/php5-7.0.10-20160831-102733/bin
$ ./php -v
PHP 7.0.10 

How do I get Apache to use PHP 7.x, and more importantly, where is PHP 5.x on my system that it's running?

Andy
  • 163

1 Answers1

-2

php can be built in various variants. There is at least a command line variant, a cgi variant, a fastcgi variant and an apache module.

You need to build a php 7 apache module, then reconfigure apache to use it.

http://php.net/manual/en/install.unix.apache2.php

plugwash
  • 6,719