PHP version mismatching - php

I started a Amazon EC2 instance using Elastic Beanstalk. It came with PHP 5.3 but I needed 5.2.
I downgraded the version and restarted apache. If I type "php -v" I see
PHP 5.2.17 (cli) (built: Oct 17 2013 16:24:38)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
But if I execute phphinfo() on the server it returns : PHP Version 5.3.27
The server is Apache httpd
Any help?

Related

Error to use terminal commands on PHP with Mac OS MAMP

I'm using MAMP 6.5 - Build 33813 (Macbook Air M1 2020) to make some Apache hosts.
All everything is ok, except one thing. I can't use terminal commands on my PHP code (exec, copy, and others).
I uninstalled my Brew PHP and using only MAMP PHP 7.2 and 8.0 (CGI).
I receive no errors or logs, just doesn't work. This is my terminal's response when I run php -v:
PHP 7.2.34 (cli) (built: Aug 5 2021 15:20:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Image - PHP MAMP Config

Change CLI PHP version on Mac

I using Mac BigSur lastest update.
I have install Bitnami MAPP with PHP version 8.0.8.
But in CLI still PHP 7.3.24
I try create PATH to Bitnami PHP8.0.8 but have warning like below
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
How to switch PHP CLI to PHP8.0.8 of Bitnami?
Bitnami engineer here!
The output you are seeing is produced by the PHP binary that comes preinstalled in macOS. When you install Bitnami MAMP, a standalone, updated version of PHP will also be installed in your system. In order to use it instead of the default one, you have two options:
Use the full path to the binary (installdir/php/bin/php)
$ /Applications/mampstack-8.0.9-0/php/bin/php --version
PHP 8.0.9 (cli) (built: Jul 30 2021 07:59:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies
Add the directory containing the PHP binary to your path
$ export PATH=/Applications/mampstack-8.0.9-0/php/bin:$PATH
$php --version
PHP 8.0.9 (cli) (built: Jul 30 2021 07:59:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies
For the examples above, /Applications/mampstack-8.0.9-0 was the installation directory (installdir) of the stack.

How I can upgrade PHP 5.1.6 to 5.2 or higher on FreeBSD 6.2?

I have Internal error message and pyrocms require PHP 5.2 up.
How I can upgrade PHP version by do not install new web server?
My server:
ns1# php -v
PHP 5.1.6 with Suhosin-Patch 0.9.6 (cli) (built: Dec 2 2008 21:35:05)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
ns1# uname -r
6.2-RELEASE
ns1#

how to update native php 5.3 mac installation with installed brew php 5.4 installation?

I am trying to work on laravel framework, i got an error for which i needed php5.4+. earlier i had installed php, apache and mysql somehow which came with mac.
when i check the versions i get as below:
$ /usr/local/Cellar/php54/5.4.19/bin/php -v
PHP 5.4.19 (cli) (built: Sep 17 2013 21:14:22) (DEBUG)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
right now php5.3 gets displed on phpinfo(), how to make apache use php5.4?
if which php still gives /usr/bin/php, add this line to the end of your ~/.bashrc (or ~/.zshrc if you use ZSH)
export PATH="$(brew --prefix)/bin:$PATH"
Also see https://github.com/josegonzalez/homebrew-php#installing-multiple-versions
EDIT
For Apache
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
php5.3, php5.4, php5.5
http://php-osx.liip.ch/
PHP 5.5
http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/

How to update PHP CLI OSX?

I just updated to php 5.4 using http://php-osx.liip.ch/ on osx lion.
when i type:
php -v
i still see:
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
But phpinfo() shows 5.4.
How do i update this?
Just Export installed PHP path ,type this on Terminal
export PATH=/usr/local/php5/bin:$PATH
I checked that /usr/local/php5/bin/php existed. It did, so I added /usr/local/php5/bin to my PATH.
Thank you #AD7six
The answer shared by both Chutipong Roobklom and user1168427 helped, if you want to update to the latest php cli which is 7.2.7 (most current and stable release as of 2018 when this post was created originally so check the latest php version, methods for switching versions may vary) then just use this instead of the php5 command. export PATH=/usr/local/php7/bin:$PATH then type php -v and you should have something that reads like this(on MACOSX by the way):
PHP 7.2.7 (cli) (built: Jun 22 2018 06:27:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
so you shouldn't be getting any errors. Hope this helps and for Kamel, that is how it is installed. You're kind of 'exposing' it in a way for your machine to now recognize which php version you are using.

Categories