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?
Related
I downloaded & installed xampp-linux-x64-7.4.6-0-installer.run on my VM using terminal. Everything went right except PHP version.
The terminal output
php -v
PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr 8 2020 15:45:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies
but php info shows version 7.4.6
is there any way to upgrade php version ??
you should be able to use this comand to set the default php version:
sudo update-alternatives --config php
constants.php
<?
define('GREETING', 'Hello World');
?>
index.php
<?php
require("constants.php");
echo GREETING;
?>
This code gives me an error : PHP Notice: Use of undefined constant GREETING - assumed 'GREETING'
(Server 1 - Not Working) Ubuntu 14.04
PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
(Server 2 - Working) CentOS 6.3
PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader v4.6.0, Copyright (c) 2002-2014, by ionCube Ltd.
(Dev Environment - Working) Windows 8.1
PHP 5.5.9 (cli) (built: Feb 5 2014 13:02:39)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader v4.5.3, Copyright (c) 2002-2014, by ionCube Ltd.
What could be the problem and how do I make it work for Server 1?
Previous programmer made used of short tags which turned the block into a comment
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.
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
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"