I've attempted to upgrade my version of PHP to 7.3 by running:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3

and then adding the new install to my PATH via the following line in my ~/.zshrc:

export PATH="/usr/local/php5/bin:$PATH"

I think that has worked adding it to my PATH as when I echo $PATH it is the first item: /usr/local/php5/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/...

In my terminal when I run php -v I get PHP 7.3.8 (cli) (built: Aug 11 2019 20:50:16) ( NTS ) but when I look at a phpinfo() file in my localhost it still says PHP 7.1:

enter image description here

I've read this could be because the apache server could be trying to use the version of php in /usr/bin instead of the one in /usr/local/php5/bin. But I can't work out how to change it to use the newly installed PHP 7.3.

If I run which php it outputs /usr/local/php5/bin/php.

My /etc/apache2/httpd.conf file has the PHP 7 module loaded:

#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php7_module libexec/apache2/libphp7.so
  • I'm not using a brew installed version of PHP. I don't have homebrew installed. – Yabsley Jul 9 '20 at 11:40
  • I'm aware of that, but the answer also covers the changes required in httpd.conf – nohillside Jul 9 '20 at 12:08
  • Forgive me but where does it cover the required changes? Are referring to "LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so"? I don't have a /usr/local/opt. It suggests the correct way is to install Apache via HomeBrew. – Yabsley Jul 9 '20 at 14:16
  • You don't have /usr/local/opt, but you installed the new libphp7.so somewhere. Apache needs to know where it is. – nohillside Jul 9 '20 at 14:23

You must log in to answer this question.

Browse other questions tagged .