Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 2nd, 2005, 5:12 PM   #1
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
PHP Script Timeout Problem

I am trying to grab some data from a website (http://www.aftenposten.no) but when I attempt to do so the website takes to long to return and causes the php timeout to kick in on my host. Can anyone think of a way that I might be able to overcome this timeout problem? Bearing in mind that I have no access or permission to access the php.ini file on this server I have to work with.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Dec 2nd, 2005, 6:35 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
PHP manual . Presuming it's a script timeout. Note the various caveats.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 2nd, 2005, 7:16 PM   #3
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Yeah, interesting function, didn't know about it. In any case though I am pretty sure that the host is running PHP in safe mode... I will run a phpinfo to find out though. Thanks.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Dec 2nd, 2005, 7:25 PM   #4
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Another option I just found out about is the init_set option. Even when in safe mode this sometimes will work and allow the maximum execution time to be modified. It will be interesting to see if the host will allow for this.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Dec 2nd, 2005, 11:45 PM   #5
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 214
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
you can change php variables like max_execution_tiem (i'm not sure what the actual name is) in your .htaccess file. Just add a line

php_value variable value

like
php_value register_globals ON

I would seriously look at your code though cause 99.9% of the time you get those errors its because you have a loop that doesnt end.
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Old Dec 3rd, 2005, 7:51 AM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Aren't you your host, Kurifu? :p
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Dec 3rd, 2005, 8:50 AM   #7
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
Quote:
Originally Posted by Ooble
Aren't you your host, Kurifu? :p
heh, that's the funny thing about hosting: reseller hosting VS machine hosting. Anybody can be their own reseller host, but most of them don't even know where the datacenters are located, let alone access to unix configs. Unless of course he does have access to the entire server, then it's just a matter of playing with php.ini
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Dec 4th, 2005, 10:34 PM   #8
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Quote:
Originally Posted by Ooble
Aren't you your host, Kurifu? :p
Yup, definatly am. This is not to be executed on my server though, and I wouldn't increase my max_execution_time beyond 30 seconds anyway.

I did manage to solve the problem. Any time spent calling system( ) or exec( ) does not count as script execution time. Since I could not change the values in this case as PHP safe_mode was turned on, I simply stopped running my system calls in the background, serialized them and spent the time out of script to process the long ugly tasks... it worked like a charm.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Dec 4th, 2005, 10:48 PM   #9
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
.htaccess....I just took a crash course in mod_rewrite and php today. Ow.

I decided that it would be nifty to have all my site data in xml files and have them transformed by the browser using an XSL stylesheet. Works like a charm. However, there's the small detail that search engines and xml+xsl don't mix. So I proceeded to write a script that parsed the xml and returned an overly simplified version of the page. I combined that with two mod_rewrite rules, one to redirect Googlebot to the /basic directory and another to cause the imaginary /basic directory to map to my script. It works...finally.

Back on the topic, some php directives can be set in .htaccess while others must be in httpd.conf/php.ini. This page gives the breakdown. The ones listed as PHP_INI_SYSTEM can only exist in the server config/php.ini while the others can be in .htaccess. These commands are the ones used to set the directives from the Apache files rather than PHP.ini. Wow...didn't know any of that this morning
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Dec 5th, 2005, 4:09 PM   #10
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Y'know, the slightly more sane among us use a server-side scripting language and databases. :p
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC