Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Configuring PHP 7.1 with Apache with Mojave

PHP 7.1.19 Apache/2.4.37

I can't get php 7.1 to work with apache since updating to Mojave?

In my browser naviogating to localhost/trial.php outputs

<?php echo "/Library/WebServer/Documents/trial.php Hello world!...";
?>

instead of

/Library/WebServer/Documents/trial.php Hello world!...

In all tutorials e.g. here, they say the Apache config file is at

/etc/apache/httpd.conf

but it is at

/usr/local/etc/httpd/httpd.conf

on my system.

Into httpd.conf I need to load the php7 image file. But I don't know where that file is and the best path I have is,

LoadModule php7_module libexec/apache2/libphp7.so

But if the config file I use is in a different place then the libphp7.so file will also be different. But how do I find it?

Also it is odd that there is no mention of a php module in the config file which suggests that maybe there is another config file that I should be putting it into.

I did try adding the .so file load module path to /etc/apache2/httpd.config and this didn't even give an error so I know that file is not used by apache at all.

I install apache and php with homebrew as per this tutorial https://jason.pureconcepts.net/2018/11/install-apache-php-mysql-mac-os-x-mojave/

Thanks,

[SOLVED] I finally solved this by following the following tutorial https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions

The issue was that I was using different versions of PHP and not doing load-module with the correct version.

Comments