How can I update the php5-cli package on this Linux distribution? - php

I have a godaddy shared hosting account
I don't know what distribution is my account using.
So, I ran the uname -a command and here is the response:-
Linux a2plcpnl0006.prod.iad2.secureserver.net 2.6.32- 531.29.2.lve1.3.11.1.el6.x86_64 #1 SMP Thu Dec 18 06:49:17 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
running the php -v command gives the following output:-
PHP 5.4.43 (cli) (built: Jul 23 2015 20:40:13)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
and running php-cgi -v command gives the following result:-
PHP 5.5.24 (cgi-fcgi) (built: Apr 20 2015 06:24:55)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
I want to update the php-cli package to version 5
Thanks.

Problem is very clear. Laravel requires php 5.5.9 version or higher. You have two options:
Update your php5-cli package
Run composer update --ignore-platform-reqs. It will update your packages without checking your php version.

Related

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.

PHP CLI has a few seconds delay

When I run PHP in the CLI mode (PHP 5.6.6 under CentOS 6.5 running as VM using VirtualBox) it has a few seconds of delay even if I only check version and there is php.ini file disabled:
time php -n -v
PHP 5.6.6 (cli) (built: Apr 2 2015 14:18:24)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
real 0m5.066s
user 0m0.012s
sys 0m0.006s
The problem is related to DNS call PHP is doing. See here and here.
The solution is to add hostname
[root#dev-machine ~]# hostname
dev-machine.com
to /etc/hosts:
127.0.0.1 dev-machine.com
Result:
time php -n -v
PHP 5.6.6 (cli) (built: Apr 2 2015 14:18:24)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
real 0m0.018s
user 0m0.012s
sys 0m0.004s

Why does running this phar file spurios characters?

I am trying to run the wp-cli on my OSX terminal. Running it on the terminal causes the following output:
PHP Version:
PHP 5.3.29 (cli) (built: Jan 7 2015 10:59:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
Why could this be happening?

How to set the php path when directly run php in command prompt

Hi I have configured php from source package and its install in /usr/local/bin/php the version was 5.2 but I have upgraded the PHP using yum repository to 5.4 which is installed in /usr/bin/php
whenever I type
root#server1:- which php
/usr/local/bin/php
showing this path and version is
root#server1:- php -v
PHP 5.2.6 (cli) (built: Oct 9 2013 07:08:43)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
and when type
root#server1;- /usr/bin/php -v
PHP 5.4.22 (cli) (built: Nov 18 2013 13:25:28)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
how do i set a default path of php to 5.4 version no need to use full path while using php
please help me
Setup a bash alias in your .bash_profile:
alias php="/usr/bin/php"

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