PHP Classes
elePHPant
Icontem

Getting Warnings and Mixed Issues

Recommend this page to a friend!

      Fast PHP CURL Multiple Requests  >  All threads  >  Getting Warnings and Mixed Issues  >  (Un) Subscribe thread alerts  
Subject:Getting Warnings and Mixed Issues
Summary:Warning: Use of undefined constant CURLOPT_TCP_FASTOPEN
Messages:8
Author:Terry Woody
Date:2018-09-12 10:52:23
 

  1. Getting Warnings and Mixed Issues   Reply   Report abuse  
Terry Woody - 2018-09-12 10:52:23
Hi, very nice class and looks like great way to handle multi requests.

Running PHP 7.2.1 and Curl 7.45.0. Using your example index.php, get the errors below:

====================
Warning: Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed 'CURLOPT_TCP_FASTOPEN' (this will throw an Error in a future version of PHP) in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: curl_setopt() expects parameter 2 to be integer, string given in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed 'CURLOPT_TCP_FASTOPEN' (this will throw an Error in a future version of PHP) in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: curl_setopt() expects parameter 2 to be integer, string given in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed 'CURLOPT_TCP_FASTOPEN' (this will throw an Error in a future version of PHP) in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: curl_setopt() expects parameter 2 to be integer, string given in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed 'CURLOPT_TCP_FASTOPEN' (this will throw an Error in a future version of PHP) in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8

Warning: curl_setopt() expects parameter 2 to be integer, string given in /opt/lampp/htdocs/testbed/curl/curl-multi-2018-08-19/lib/class.curlmulti.php on line 8
====================

The page is displayed below the warnings, but any idea how resolve above warnings?

I first tired using on a live domain/server and getting a blank page with no error log produced. Will not work at all. Live server is also running PHP 7.2.1

Thanks!

  2. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
riccardo castagna - 2018-09-12 11:56:28 - In reply to message 1 from Terry Woody
Ok, thank you for your message. I think, probably, there is a problem with linux server and the option CURLOPT_TCP_FASTOPEN; linux is much more precise and rightly wants the correct parameters.

In this moment I am not able to make a test on linux server,
in the meantime I try to fix the error for this option and update the class,

try to change the param "TRUE" with "1L" on line 8 file lib/class.curlmulti.php

in this way:

curl_setopt($x, CURLOPT_TCP_FASTOPEN, 1L);

if not even this way it works
you can try to delete the line number 8 : curl_setopt($x, CURLOPT_TCP_FASTOPEN, TRUE);
from the file lib/class.curlmulti.php, this should not change performance.

  3. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
riccardo castagna - 2018-09-12 12:07:53 - In reply to message 2 from riccardo castagna
Sorry not with "1L" but just "1"

try this ...

if it should still report errors you are authorized :)) to delete the line 8

  4. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
Terry Woody - 2018-09-12 13:45:21 - In reply to message 3 from riccardo castagna
Thank you Riccardo.

Adding the 1 did not result in change, still shows warnings.

Commenting the line out:

//curl_setopt($x, CURLOPT_TCP_FASTOPEN, TRUE);

did fix and is working wonderful now.

Not sure why will not work at all on live server, but will try to find out and report back. Currently getting blank page with no error produced.

Cheers!

  5. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
Terry Woody - 2018-09-12 14:27:05 - In reply to message 4 from Terry Woody
On another note:

I got the error about 30 second timeout (pretty sure came from curl) when a site was slow to load.

Added:

curl_setopt($x, CURLOPT_TIMEOUT, 20);

and fixed the issue.

Seems if the URL does not respond at all, script continues to work, but if URL slow to to load the timeout error appears and no other URL's load.

  6. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
riccardo castagna - 2018-09-12 14:35:18 - In reply to message 4 from Terry Woody
Very good Terry, and thank you again,
I have a motto: in doubt delete ;-) !!!

if you find something to fix the problem for the Option CURLOPT_TCP_FASTOPEN let me know ...

perhaps could be probably some security issue ...

Bye

  7. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
riccardo castagna - 2018-09-16 12:48:04 - In reply to message 1 from Terry Woody
Houston we have a solution about the CURLOPT_TCP_FASTOPEN !!!

It was introduced with libcurl version 7.49.0, view:
curl.haxx.se/libcurl/c/symbols-in-v ...

and you are using 7.45.0 libcurl version, if you are able to update your libcurl version to 7.49.0 it should work.

Bye and thank you again for your good evaluation.

  8. Re: Getting Warnings and Mixed Issues   Reply   Report abuse  
Terry Woody - 2018-09-17 16:43:57 - In reply to message 7 from riccardo castagna
Very good info, thank you for follow up.

Will see about updating curl to latest.

Cheers!