Jump to content

Recommended Posts

In my website, I am making an http request to a different server. But sometimes what happens is that the server is down and it takes either too much time to return or it doesn’t return at all. So at the end the “connection timed out” error comes up and because of which my site also becomes slow.

Is there a way in PHP in which I can check that if the server is taking too much time, I can end the connection (say after 5 secs) on my own and continue the execution of my site? The idea is that my website should not become slow.

I tried using set_time_limit() function but it is not working. Any help would be highly appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/141054-help-when-server-is-down/
Share on other sites

In my website, I am making an http request to a different server. But sometimes what happens is that the server is down and it takes either too much time to return or it doesn’t return at all. So at the end the “connection timed out” error comes up and because of which my site also becomes slow.

Is there a way in PHP in which I can check that if the server is taking too much time, I can end the connection (say after 5 secs) on my own and continue the execution of my site? The idea is that my website should not become slow.

I tried using set_time_limit() function but it is not working. Any help would be highly appreciated.

 

Hi,

have you tried setting the server connection limit in your configuration files

In my website, I am making an http request to a different server. But sometimes what happens is that the server is down and it takes either too much time to return or it doesn’t return at all. So at the end the “connection timed out” error comes up and because of which my site also becomes slow.

Is there a way in PHP in which I can check that if the server is taking too much time, I can end the connection (say after 5 secs) on my own and continue the execution of my site? The idea is that my website should not become slow.

I tried using set_time_limit() function but it is not working. Any help would be highly appreciated.

 

Hi,

have you tried setting the server connection limit in your configuration files

 

Do you mean max_execution_time..? If yes, then it is set as the default value i.e., 30.

If not, then how to do that?

In my website, I am making an http request to a different server. But sometimes what happens is that the server is down and it takes either too much time to return or it doesn’t return at all. So at the end the “connection timed out” error comes up and because of which my site also becomes slow.

Is there a way in PHP in which I can check that if the server is taking too much time, I can end the connection (say after 5 secs) on my own and continue the execution of my site? The idea is that my website should not become slow.

I tried using set_time_limit() function but it is not working. Any help would be highly appreciated.

 

Hi,

have you tried setting the server connection limit in your configuration files

ae..? If yes, then it is set as the default value i.e., 30.

If not, then how to do that?

 

 

max excution time can be set by the directive max_execution_time = 10. In xampp\apache\bin\php.ini.Likewise You have to change it in php.ini files in the following folders

 

xampp\php\php4\php.ini

xampp\php\php5.ni

xampp\php\php.ini

 

max excution time can be set by the directive max_execution_time = 10. In xampp\apache\bin\php.ini.Likewise You have to change it in php.ini files in the following folders

 

xampp\php\php4\php.ini

xampp\php\php5.ni

xampp\php\php.ini

 

 

I don't have access to the php.ini file. And even if i manage to change this file, it will affect other parts of the site.

It would be very helpful if anyone provide me with some other solution.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.