3

I'm on OSX Lion 10.7.5. As advised at How do I upgrade PHP in Mac OS X?, I used:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4

Everything appeared to go well, no errors, I'm on a 64bit system, etc., but when I run "php -v" I still see the same version I had before (5.3.15). On a scale of 1-10 I'm probably a 2 when it comes to installing stuff via the command line, so, please factor that into any responses.

UPDATE: I took a closer look at the Terminal output after running curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4 and I noticed the following:

Installing package tools-memcached into root /
./pkg/pre-install
pkg/pre-install
Skipping existing directory 
Skipping existing directory usr/
Skipping existing directory usr/local/

...then at the end of the installation:

Create symlink /usr/local/php5/entropy-php.conf /etc/apache2/other/+php-osx.conf
Removed /usr/lib from DYLD_LIBRARY_PATH in /usr/sbin/envvars
Restarting Apache
httpd: Could not reliably determine the server's fully qualified domain name

Can anybody elaborate on precisely what that means? As explained in the comments, it seems I've got the files installed, but, I'm having trouble resolving what appears to be a $PATH issue.

Community
  • 1
  • 1
vtacreative
  • 618
  • 8
  • 22
  • 1
    The old version of PHP is being found first in your `$PATH`. To see which one you are calling from the CLI, do `which php`. That will probably return some PHP 5.3 version. – Michael Berkowski Nov 25 '12 at 03:00
  • @soulseekah: restarting didn't help, but thanks! – vtacreative Nov 25 '12 at 03:04
  • 1
    Then your old php (`which php`) path is different from the install path of this `install.sh` script which is `/usr/local/`, you have to `ln -s` or copy the old binary over to your `which php` path. – soulseekah Nov 25 '12 at 03:05
  • @MichaelBerkowski: when I run "which php" I get "/usr/bin/php" and when I run "/usr/bin/php -v" you are correct, it returns the old version. The php-osx.liip.ch page says "The php.ini is located in /usr/local/php5/lib/php.ini," does that mean I have to add "/usr/local/php5/lib/" to the $PATH variable? – vtacreative Nov 25 '12 at 03:07
  • 2
    @CL75 The new one's executable path is probably /usr/loca/bin/php. Find where the executable is, then add that to your `$PATH`. However, that doesn't mean that Apache will find the right one either. I can't necessarily help with that because I don't have a Mac handy. – Michael Berkowski Nov 25 '12 at 03:09
  • In /usr/bin/ it seems there are only two php-related executable files, "php" and "php-config" neither of which were created today. How do I find out where the executable resides for the new installation? There are two PHP installations in /usr/local/, the one installed today is simply "php5". I'm not sure if this is right, but I tried these changes: Old: PATH=/usr/local/bin:/usr/bin:/opt/local/sbin: New: PATH=/usr/local/php5:/usr/local/bin:/usr/bin:/opt/local/sbin:$PATH …but it still lists the old version. – vtacreative Nov 25 '12 at 03:28
  • I also tried adding "/usr/local/php5/bin:" to $PATH because it seems there is php exe file in "php5/bin" but it still returns the old version. – vtacreative Nov 25 '12 at 03:31
  • Just to confirm, "/usr/local/php5/bin/php -v" returns "PHP 5.4.7", so it seems I've located the new install, but for some reason it still returns "5.3.15" when running "which php", even after adding /usr/local/php5/bin: to $PATH variable. Does that seem like the correct addition for the $PATH variable? Like I said, I'm pretty new to installing things via CLI. – vtacreative Nov 25 '12 at 04:03

2 Answers2

5

create a sym link to the path of your new php install like this:

ln -s /usr/local/php5/bin/php php
botbot
  • 7,299
  • 14
  • 58
  • 96
1

If you use Apache first disable current php module

sudo a2dismod php5
sudo a2dismod php5.6

then enable

sudo a2enmod php7.0

and restart apache

sudo service apache2 restart

Sasa Jovanovic
  • 324
  • 2
  • 14