PHP CLI has a few seconds delay - php

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

Related

Php script is running on one machine and not on another

I have an automated process to run a php script on 2 machines. It does the following:
/opt/rh/php54/root/usr/bin/php myphp.php
However, It is not running on Host 1(error: /opt/rh/php54/root/usr/bin/php: not found) but running fine on Host 2:
Host 1: Not running
PHP 7.2.9 (cli) (built: Aug 15 2018 09:19:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Host 2: running fine
PHP 5.4.40 (cli) (built: Jul 22 2016 07:31:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
/opt/rh/php54/root/usr/bin/php--->>> This path does not exist on host 1
SELinux is disabled on both hosts.
PHP will not be installed to the path u are using. Try to use php myphp.php instead.
The path \opt/rh/php54/root/usr/bin/php does not seem to be correct. Find out the correct path for the php installation directory.
You can use which php or whereis php command.

Configuring PhpStorm for using built-in web server in OS X Mojave

The question is the following: what are the minimal-required steps to have PhpStorm configured for using built-in web-server on Mojave system?
I mean, installing the least possible additional software on my system (just started from scratch recently and want to keep number of installed software at the minimal level).
I have php and php-fpm installed "out of the box":
$ php -v
PHP 7.1.19 (cli) (built: Aug 17 2018 18:03:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
$ php-fpm -v
PHP 7.1.19 (fpm-fcgi) (built: Aug 17 2018 18:03:20)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
Still, when trying to configure "PHP interpreter" in PhpStorm, I end up with this error message:
php-cgi not found: Please ensure that configured PHP Interpreter built
as CGI program (--enable-fastcgi was specified)
Doesn't php-fpm implement Fast-CGI?…

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

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.

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?

Why PHP in CLI need a few seconds to start?

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

Categories