I got problem. My PHP 5.5.8 need a few seconds to start.
If in terminal run this command php -v, it will print version only a few seconds later (about 13). But second run prints it immediately. If i wait a little bit all the same.
What to do?
$ time php -v
PHP 5.5.8 (cli) (built: Jan 12 2014 18:50:29)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
real 0m13.375s
user 0m0.029s
sys 0m0.024s
Related
I read that there is a problem with PHP 7.2 and if you want to use ARGON2 you need to compile php using –with-password-argon2
In my case I'm using PHP 7.3.6
php -v
PHP 7.3.6 (cli) (built: Jun 22 2019 11:43:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
If I try:
var_dump(password_hash('password', PASSWORD_ARGON2I));
it returns:
PHP Warning: Use of undefined constant PASSWORD_ARGON2I - assumed 'PASSWORD_ARGON2I' (this will throw an Error in a future version of PHP)
More info: MacOS Sierra
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
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
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?
On Ubuntu machine:
$ php -v
PHP 5.5.10-1~dotdeb.1 (cli) (built: Mar 6 2014 18:55:59)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with uopz v2.0.4, Copyright (c) 2014, by Joe Watkins <krakjoe#php.net>
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
My test.php file is simple:
<?php
exit(1);
I would expect this command php test.php || echo "error" to show "error" but it exits with status code 0.
$ php test.php
$ echo $?
0
But on the same machine the same code, but not in file works as expected:
$ php -r "exit(1);" || echo "error"
error
or
$ php -r "exit(1);"
$ echo $?
1
On different machine (archlinux) with php:
PHP 5.5.13 (cli) (built: May 29 2014 05:46:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
All cases work as expected, even when the code is run from file the status code is 1.
This is a true problem because git hooks depends on this status codes and Jenkins and I couldn't google it out.
Could it be somehow config-related? I checked cli php.ini and couldn't find anything suspicious.
The uopz extension is the problem. It "corrupts" the exit code. There was a bug opened about this issue.
You can try to set the configuration uopz.overloads=0 as it was recommended in the bug comments. That, unfortunately didn't work for me. Only disabling the extension fixed the issue.