-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve detection of PHP CLI #19
Comments
This is my code that checks if it's running under CLI.
This is the output I see
and this is the output from tracing.
|
I'm not going to give up with this just yet. I can't clone the code to different folders and reproduce the problem in those folders. The problem can be simplified to.
The expected output is:
|
This is the simplest demonstration of the problem. Setup
browsed.php
issue-19.php
Steps
For step 1. the result is expected to: To get the other combinations simply So is it a constant or isn't it? |
Note: I can't reproduce the problem in my Windows server running Apache. |
This problem could also explain the "That's odd" message from oikb_check_time_limit() which was being displayed every now and then for no obvious reason. |
Tested this on a chassis vagrant box (nginx, php7.1-fpm) and worked fine. In the browser: |
Thanks Matt.Alain Schlesser got the same result as you. SiteGround are going to try as well. I'm going to check which php executable gets called. Your result may be different because of Xdebug. |
In my .bashrc file php is set as an alias to php-cli
I get the same problem with both PHP 7.0.x and PHP 7.1.x php -v gives: PHP 7.0.16 (cli) (built: Feb 20 2017 11:16:52) ( NTS ) |
On different hosting I got the same results as Matt and Alain. [oikcouk@host58 public_html]$ php issue-19.php |
This is a belated follow up to the issue that I reported at WordCamp London I have today reproduced the problem on https://rowlandscastle.org.uk/path/issue-19.php See below for more details. Extract from Anton's response, dated 4th May 2017.
Today's tests ( 23 Jun ) Replication of problem on rowlandscastle.org.ukWith PHP 7.0.16Implemented the code referenced in #19 (comment) under account rcorguk
set up a php alias for PHP 7
Run tests. The results demonstrated the same problem as before. Note: php -v gives
With PHP 7.1.2
Used cpanel to change PHP version of the
I was able to reproduce the problem.
|
When trying to run some new code under oik-batch to set letter taxonomy terms I discovered that the value of the PHP constant PHP_SAPI was not constant!
Whereas php_sapi_name() was correctly returning "cli", PHP_SAPI was changing from "cli" to "cgi-fcgi".
My code, which tested the value of PHP_SAPI was not being invoked.
Is this truly unexpected behaviour?
Current situation
Using a workaround but not a happy bunny.
Could be a hosting problem?
The text was updated successfully, but these errors were encountered: