0

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.

Kevin
  • 1
  • 1
  • You stated that you are running this from the CLI, AFAIK when running a script from the CLI `max_execution_time` is set to 0, which means the script shouldn't stop executing unless finished or explicitly cancelled e.g. `Ctrl+C`, so I dont tihnk the script is timing out, have you enabled error reporting? https://stackoverflow.com/questions/845021/how-can-i-get-useful-error-messages-in-php – RJK Jan 05 '21 at 14:20
  • Check error reporting is turned on. Look at the logs as well as the terminal output – RiggsFolly Jan 05 '21 at 14:21
  • _when 1 function simply takes to long to finish_ How do you know the issue is related to length of execution time unless you have seen something to tell you that – RiggsFolly Jan 05 '21 at 14:24
  • Increase or remove the [time limit](https://www.php.net/manual/en/function.set-time-limit.php). – Markus Zeller Jan 05 '21 at 14:25
  • Check the syslog to see if the operating system terminated the process (e.g. due to running out of memory). – obe Jan 05 '21 at 14:27
  • You could show us a `>php -i` – RiggsFolly Jan 05 '21 at 14:28
  • Also, if you have Zend OPCache enabled, then try to disable it and see if it makes a difference (in `php.ini` - search for `opcache.enable`). Note that it's common to have two separate `php.ini` files for web and for CLI, so you may need to check both. – obe Jan 05 '21 at 14:31
  • 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. – Kevin Jan 05 '21 at 15:11

1 Answers1

0

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

Kevin
  • 1
  • 1