开发者

Problem with PHP server

I'm having some problems with my PHP server. Most of the functions when run gives the same error.

Warning: fopen(http://www.ietf.org/rfc/rfc2475.txt) [function.fopen]: failed to open stream: 
A connection attempt failed because the connected party did not properly 开发者_JAVA百科respond after a 
period of time, or established connection failed because connected host has failed to respond. D:\inetpub\vhosts\coolfbapps.in\httpdocs\test\merger2.php on line 3

Fatal error: Maximum execution time of 30 seconds exceeded in D:\inetpub\vhosts\coolfbapps.in\httpdocs\test\merger2.php on line 3

The same error comes when i use imagecreate functions, get_image functions.

I talked to service providers but they said I should tell them the cause of this error so that they can rectify it. Please se if any one can make out what changes should be done to server to remove those errors.

CODE USED

$ch = curl_init("http://www.gravatar.com/avatar/95111e2f99bb4b277764c76ad9ad3569?s=32&d=identicon&r=PG");
$fp = fopen("http://www.ietf.org/rfc/rfc2475.txt", "r");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);


Sorry for this, but I'm unable to comment yet. You need to post the code that is causing these errors. Are you explicitly requesting that URL?

To debug this, you should logon to the server and attempt to request the file to see if you're actually able to have outbound connections on port 80. To do this on a linux server just run

wget http://www.ietf.org/rfc/rfc2475.txt

.. and see if it fails or not. If it does, you need to talk to your hosting provider / ISP.

If you don't have access to the server you could simply try (in PHP):

<?php
file_get_contents('http://www.google.com/'); // Google so that it's not the same URL
?>

If there's an error, same as above.


The first error (the fopen() one) is caused because of a timeout in the response of the server you're trying to load the data from. i.e. the server is taking too long to respond, so the connection times out.

The second error is that the script is running for too long. PHP has a setting called max_execution_time so that a script can't eat up all the resources on a server. Your server has a setting to allow 30 seconds to execute, or die() with a fatal error.


Seems your server can't connect to these sites. Perhaps your server is not allowed to start outgoing connections or is blocking that outgoing HTTP traffic somehow?

I bet this isn't a PHP problem but instead has to do with your server connection. If you have SSH access, try to open these URLs from the command line without PHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜