|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-04-21 10:03 UTC] spam2 at rhsoft dot net
[2019-04-21 21:52 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-04-21 21:52 UTC] requinix@php.net
[2019-04-22 07:11 UTC] ghislain at ghislain dot net
[2019-04-22 07:37 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Description: ------------ hi, PHP Version 7.2.17-1+0~20190412070953.20+jessie~1.gbp23a36d System Linux 4.9.168-vs2.3.9.8aq #1 SMP Tue Apr 9 13:28:31 CEST 2019 x86_64 when using curl_exec on an url that do not answer on php7.2 fpm, the php fpm process can stay open forever if some curl timeout is not set. This means that curl is bypassing all php internal timeout like set_time_limit max_execution_time default_socket_timeout and even ignore_user_abort. The only way is to add curl specific time out //curl_setopt($ch, CURLOPT_TIMEOUT, 10); //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl extention should not be able to bypass general php safeguards. best regards, Ghislain Test script: --------------- <?php echo date('l jS \of F Y h:i:s A'); // Création d'une nouvelle ressource cURL $ch = curl_init(); set_time_limit ( 10 ) ; # Make sure to keep alive the script when a client disconnect. ignore_user_abort(false); // Configuration de l'URL et d'autres options curl_setopt($ch, CURLOPT_URL, "http://myserver.com/curltest.php"); curl_setopt($ch, CURLOPT_HEADER, 0); //curl_setopt($ch, CURLOPT_TIMEOUT, 10); //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if(curl_exec($ch) === false) { echo 'Erreur Curl : ' . curl_error($ch); } else { echo 'L\'opération s\'est terminée sans aucune erreur'; } // Fermeture de la session cURL curl_close($ch); echo date('l jS \of F Y h:i:s A'); ?> +http://myserver.com/curltest.php = <?php sleep( 12000); ?> Expected result: ---------------- script should stop at 10s or at max execution time. Actual result: -------------- stay on until a php-fpm restart