1

Anyone know anything about troubleshooting a PHP Curl problem? I have been using RollingCurl with great success on my OSX laptop, however when I upload to my Ubuntu server the same code fails to yield a result.

So there is clearly something wrong server side, the error logs are clean. I have no idea what to check... any help? Anyone!?

Thank you so much in advance, Stu

![http://rolling-curl.googlecode.com/svn/trunk/

Ubuntu 12.04 result 
Array ( \[url\] => \[content_type\] => \[http_code\] => 0 \[header_size\] => 0 \[request_size\] => 0 \[filetime\] => 0 \[ssl_verify_result\] => 0 \[redirect_count\] => 0 \[total_time\] => 0 \[namelookup_time\] => 0 \[connect_time\] => 0 \[pretransfer_time\] => 0 \[size_upload\] => 0 \[size_download\] => 0 \[speed_download\] => 0 \[speed_upload\] => 0 \[download_content_length\] => -1 \[upload_content_length\] => -1 \[starttransfer_time\] => 0 \[redirect_time\] => 0 \[certinfo\] => Array ( ) \[redirect_url\] => )

Local OSX Leoard result
Array ( \[url\] => http://www.google.co.uk/ \[content_type\] => text/html; charset=ISO-8859-1 \[http_code\] => 200 \[header_size\] => 1535 \[request_size\] => 108 \[filetime\] => -1 \[ssl_verify_result\] => 0 \[redirect_count\] => 1 \[total_time\] => 0.597785 \[namelookup_time\] => 0.033881 \[connect_time\] => 0.070866 \[pretransfer_time\] => 0.070939 \[size_upload\] => 0 \[size_download\] => 43439 \[speed_download\] => 72666 \[speed_upload\] => 0 \[download_content_length\] => 221 \[upload_content_length\] => 0 \[starttransfer_time\] => 0.171418 \[redirect_time\] => 0.147887 )][1] 
Stuart
  • 690
  • 2
  • 9
  • 26
  • lets see ur rolling curl code – Ryan Oct 17 '12 at 18:37
  • http://rolling-curl.googlecode.com/svn/trunk/ Using the sample data AS it works locally but not in production and of course it avoids complication. – Stuart Oct 17 '12 at 18:39
  • oh ok .yeah i migrated rollingcurl code from local to remote and it worked flawlessly – Ryan Oct 17 '12 at 18:43
  • Make sure you see all errors/warnings raised. For example with `error_reporting(E_ALL)` before running anything. – troelskn Oct 17 '12 at 19:25

2 Answers2

1
if (ini_get('safe_mode') == 'Off' || !ini_get('safe_mode')) {
 $options[CURLOPT_FOLLOWLOCATION] = 1;
 $options[CURLOPT_MAXREDIRS] = 5;
}

Here is the problem... I commented it out to test and BANG.... flys into action. Thank you all for your help.

Stuart
  • 690
  • 2
  • 9
  • 26
0

Check your php.ini configuration file in your ubuntu server. In this article you can see many of the good practices that many people (and now, some packages do) to protect their servers from attacks: http://blog.up-link.ro/php-security-tips-securing-php-by-hardening-php-configuration/

UPDATE.

To make it more clear:

  1. Log in to your ubuntu server as an admin user.
  2. Change to the configuration file's directory

     cd /etc/PHP5
    
  3. Search in the file for allow_url_fopen = Off value by using the following command:

    sudo nano php.ini
    
  4. Change the value to On and press CTRL+X answer "yes" to save the changes and quit nano editor

Luis M. Valenzuela
  • 149
  • 1
  • 2
  • 10
  • Without wanting to sound ungrateful that doesnt help – Stuart Oct 17 '12 at 18:59
  • I am familiar with editing it but as to what need to be edited is another thing! Thank you for the clarification, I will try that and come back with the news! – Stuart Oct 17 '12 at 19:23
  • As troelSkn say's turn on `display_errors = Off` to On to start. Default value is Off. This might give us a clue of what's happening. – Luis M. Valenzuela Oct 17 '12 at 21:12
  • Also found this... [stackoverflow single curl works multiple no](http://stackoverflow.com/questions/9840688/php-single-curl-works-but-multi-curl-doesnt-work) – Luis M. Valenzuela Oct 17 '12 at 21:14
  • added allow_url_fopen, and verified working with phpinfo(), still the same result. – Stuart Oct 18 '12 at 08:30
  • So I tested also with this http://www.somacon.com/p537.php and it works, so it is just rollingcurl that doesn't work. I can find no articles about rollingcurl requirements. – Stuart Oct 18 '12 at 10:42