Set php version in CentOS 6 - php

I just successfully upgraded my server php version from 5.3 to 5.6
When I run:
php -v
I get:
PHP 5.6.40 (cli)
But when I create a file write
echo phpInfo();
The php version showing is 5.3.3
How do I set the php version on phpinfo() to show 5.6
Thanks,

Try this..
rm /usr/bin/php
ln -s /usr/bin/php56 /usr/bin/php
service httpd restart
And then run
php -v

Related

OSX - phpinfo() and php -v versions are different

I've formatted my computer, install Homebrew and run brew install php && brew upgrade php, and after check my php version with php -v shows me 7.4 that's correct. But when I run phpinfo() in localhost, shows me php version is 7.1.
I have put paths to .bash_profile file like that
export PATH=/usr/local/Cellar/php/7.4.5_1/bin:$PATH
export PATH=/usr/local/Cellar/php/7.4.5_1/sbin:$PATH
php -v is true, php-fpm -v is true but apache shows me PHP Version 7.1.23
How can I fix this?

Ubuntu/Apache2 Change PHP Version

I'm trying to use pthreads but for this i hafe to install the pthread php extention.
My server is already setup with php 7.0 and as I read whats the best way to use it is i found this https://gist.github.com/emiglobetrotting/4663ffc4484e9384a261#file-php7_zts_pthreads-sh-L95
This is a manual how to compile ur own php version with Thread Safety enabled
i did this and now if I run
php -v
it show me the correct php version:
PHP 7.3.0-dev (cli) (built: May 7 2018 09:54:09) ( ZTS DEBUG )
but if i run phpinfo on my Apache I found:
PHP Version 7.0.28-0ubuntu0.16.04.1
So now i look for a way to change this in my apache config but what ever i try it leads me to the same problem:
I need a module that i can enable.
So my question is how could i change my apache to the correct version or how can i create/install a module to use the new php version?
You can do this by following commands.
sudo a2dismod php7.3.0-dev ; // To disable a PHP 7.3.0-dev version
sudo a2enmod php7.0 ; // To enable a PHP 7.0 version
sudo service apache2 restart // then restart apache

PHP version on MacOS X 10.11 issue

Recently I updated the default PHP version on MacOS X 10.11 to the newer 7.1.4, but when I do php -v on the terminal it says this: PHP 5.5.38 (cli) (built: Aug 21 2016 21:48:49).
I created the phpinfo on the web root and it says that the version is actually the 7.1.4.
What should I do to resolve this issue? Is this a real issue?
Since you said:
I used the command curl -s php-osx.liip.ch/install.sh | bash -s 7.1
I took a look at https://php-osx.liip.ch, which says:
Why does php -v on the command line still show my old version?
php-osx doesn't overwrite the php binaries installed by Apple, but
installs everything in /usr/local/php5. The new php binary is
therefore in /usr/local/php5/bin/php.
You can also adjust your PATH do include that directory, eg. write
into your ~/.profile file the following
export PATH=/usr/local/php5/bin:$PATH

cannot update php 7 cli in my mac

To install php7 I run:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
php -v
It show php 5.6.30
Then, I run this in my terminal:
export PATH=/usr/local/php5/bin:$PATH
php-v
It show the latest version of php : 7.1 .
When I closing the terminal and run the php -v again.
it show the old version php again 5.6.30
Why is this happening?

Mac OSX Terminal Setting PHP path not permanent

I've got a MAC OSX (Capitan to be precise).
I have installed PHP7 by using this line of code in the terminal:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
After it installed I run this:
export PATH=/usr/local/php5/bin:$PATH
After this when I run:
PHP -v
I get PHP 7.0.10 (cli) (built: Aug 31 2016 10:25:51) ( NTS )...
when is what I need it to do, so great BUT my problem is that as soon as I close my terminal and I run PHP -v again I get PHP 5.5
Why doesn't it keep PHP 7.0 ?
Add export PATH=/usr/local/php5/bin:$PATH to your ~/.profile dotfile so that the PATH variable is exported when you start your system (requires restart).
Or add it to ~/.bashrc file so that it gets exported when you start you start bash.
I recommend using ~/.profile.

Categories