Recently we updated our server from PHP version 5.6 to PHP 7.4, since this upgrade we are experiencing some very strange behaviour of some scripts.
The script themselves are fully PHP 7 suitable, there are no error logs or what so ever being printed or even logged when the problem occurs.
What happens is follows:
A script is started, this script calls several functions, when 1 function simply takes to long to finish then the main script stops, there is no error or output given what indicates that something is or went wrong.
It does not matter if we run this script by a GUI or via CLI, on both the result is the same.
The script stops/breaks (on cli you are back on prompt) every time when a called function (does not matter what function) simply takes to long to finish, as mentioned the cause is NOT a php code error, the code is valid.
When the same script is ran using php 5.6 then the script keeps waiting until the called function is finished and then normally continues as it supposed to.
It looks like there is a (new) setting somewhere in PHP7 which limits the execution time that a called function may run otherwise I cannot explain this behaviour, the problem here is which setting is this exactly and how do I change it, the obvious settings we already changed.
Has someone an idea where to look or search for these kind of settings?
The system is running on Centos 8 and using PHP 7.4.13 (or php 5.6), when using an older PHP version (7.2) the problem is the same, only php 5.6 does not have this problem at all.
Error reporting is turned on, no errors are logged whatsoever. If we run a script on PHP 7.4. The script stops from CLI after a short period (1 - 2 minutes). When running the same script on PHP 5.6 it runs for a long time (which it should in this case). Our developpers found that a function that calls another function to check whether an email account exists (HELO check) takes longer than 2-3 seconds, the entire PHP script is stopped in 7.4 where PHP 5.6 just waits longer and runs the entire script
Related
last year i have purchased an encrypted script wich run two crons jobs, a month ago crons stop working and i have talk to the hosting company they said its script problem , The PHP cron file works fine without any errors when visited by browser, the script provider told me that this issue should be fixed by hosting service and refuse to help !
here the command used it run every 10 MIN /home/username/public_html/cron/cron.php
cPanel Version 64.0 (build 24)
Apache Version 2.4.25
PHP Version 5.6.30
my question is it true upgrading the PHP version will affect cron job and how can i solve this?
thanx
In short, yes, upgrading PHP can effect your scripts -- the crons aren't run by Apache or PHP; the crons run from the OS level.
Your PHP upgrade is most likely affecting the crons in one of two ways:
The upgrade was large, like PHP5.6 to PHP7.0 and there's a deprecation warning somewhere (which will output in the crons' log) or the script is running some code that's now fully deprecated; most likely a query or a class/method named after a reserved word. Your logs will have more info, just make sure you have debugging turned on, otherwise your errors will be suppressed.
The new PHP settings from the upgrade have disabled some of the allowed rules from an older PHP version, such as getting away with empty or unassigned variables, and now your script is running into errors (ie. using a variable that doesn't exist, such as $_REQUEST['something'], which would have been empty but now returns an error that effects the rest of the script).
To fix this you need to know what the problem is. The easiest way is to access the log files that crons often create. If you don't get that with your host, ask them for it, or ask them to send you a copy of the error that's being created -- a quick Google on the error will tell you what the problem is. But without knowing more about the script or the error log, you probably won't get a better answer.
old command is working its just me i did copy past from my old backup and i forget the PHP at the firts off command ! nothing has changed the command should be like that exp : php /home/username/public_html/cron/cron.php
I have a simple PHP script that I created to do some basic maintenance on my DynamoDB account and I would like it to run daily. I have it set up on my host which is GoDaddy Windows based / plesk. When I go directly to the page via a browser it runs perfectly and does exactly what I want. However I set it up as a scheduled task and I get this error every time it runs:
Status: 500 Internal Server Error
Content-type: text/html
PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in **path removed**\AWS\Aws\functions.php on line 36
I have googled and have found tons of sites with this error but they all say that it was related to the PHP version being earlier than 5.5 and PHP 5.5 minimum is required. However I am running PHP 5.6, plus like I said it runs fine if I just go through a browser, it's the scheduled task that doesn't work...
I'm guessing there is something different about the way a task is pathed or run or something but I can't figure out what it is, does anyone have any insight?
Well technically the error being thrown is the 'unexpected T_VARIABLE' error referenced at Reference - What does this error mean in PHP?, that's not really the issue. That php file is inside the AWS SDK so I don't think the answer is that it's coded wrong. Also it runs on a normal page, just not in task scheduler so really the question is what am I doing wrong with task scheduler that is making it error out...
Ok I'm dumb, I knew it would be something simple. In case anyone has the same issue, the path I put for the php executable in task scheduler was the one for PHP 5.4, not 5.6. I had my hosting set for PHP 5.6 but was telling task scheduler to run PHP 5.4 hence the error. Updated the exe path and it works now.
I get a strange PHP bug on a PHP 5.6 / Symfony 2.7 project, running on a CentOS6 server through Apache.
I have a Symfony console command running as a service which launches some other console commands every 2 seconds. I use the Symfony Process component to launch the sub-processes and have timeout management.
And everything is done to avoid to launch parallel processes from the main command.
The issue I have is that sometimes php console commands doesn't stop after finishing their process. Which means that if I launch by hand the commands, everything runs correctly on the PHP side but I don't get the hand back on the console after the PHP statements finished, unless I use Ctrl+C.
The issue was happening a lot of times when the PHP version was 5.5, but now with PHP 5.6 it (only) happens randomly. When it happens, I can see a lot of stucked php sub-processes, probably launched by the main command.
I just can't find any explanation since php commands doesn't raise any error. It's just that the console get stuck and wait for something to finish.
Has anybody a possible solution to this issue?
I have a PHP 5.3.22 windows server running PHP in fastCGI. It's a Windows Server 2012 but I have also tried this on a Windows Server 2003 box so it does not seem IIS version specific.
If I have a basic PHP page:
<?php
echo 'test';
?>
Why does this take 1 second to load? This overhead seems to stack with further AJAX requests to PHP so this 1 second seems to be adding up.
Basic HTML pages just containing a word "test" from the same server is near instantaneously.
Surly it can’t just be that it takes servers a second to realise this is a PHP file and to prepare PHP for code execution.
I have tried setting the application pool to have more worker processes and to have it’s start mode as “AlwaysRunning” instead of “OnDemand” but alas this seems to have no impact.
Unfortunately changing the PHP version is not an option at this time (would take too long testing, etc).
If it's a clean start, then you shouldn't be experiencing delays anything like that. Perhaps check if you have any plugins or similar running. Xdebug slows down executions, for example.
My server was running PHP scripts perfectly up until now. I don't know what happen to my server, but the PHP scripts are not running, instead, it is automatically commented by the server. When I uploaded my php script to show PHPINFO, this is what gives me back:
<!--?php
// Show all information, defaults to INFO_ALL
phpinfo();
?-->
if you view the source code, you would see that my php scripts are commented. What should I do to get my PHP scripts running?
Thanks for helping.
Does the same thing occur if you execute the script from the PHP command line interface?
Seems like something external is explicitly disabling PHP execution either at the web server level or software level. Are you using some type of framework around PHP which my be limiting PHP execution, ie CakePHP, joomla etc?