TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-27-2010, 06:57 PM   #1 (permalink)
The Wanderer
 
Schroder's Avatar
 
Join Date: Mar 2008
Posts: 20
Thanks: 0
Schroder is on a distinguished road
Default PHP Cron Running Slow

Hello,

I'm running into a peculiar problem with my PHP script. It runs fine when executed from the linux shell, taking up to 30 seconds, however when the cron job system runs the script it times out at 2 mins and is no where near done. I wanted to see if anyone here might know of a general issue before I start diving into this more.

The script itself checks ports and websites to make sure they are up. It uses socket functions, as well as file_get_contents.

Best Wishes,
Justin
Schroder is offline  
Reply With Quote
Old 11-27-2010, 11:34 PM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I would add some sort of logging functionality to the script so you can see where it is hanging up. Something like this (this is untested, but a general idea):
PHP Code:
<?php
//Function
function log($file,$message)
{
    
$dateTime date("F-d-Y H:i:s");
    
$file __FILE__;
    
    
$string $file '(' $dateTime ') ' $message "\n";
    
    
$fd fopen($file"a");
    
fwrite($fd$string "\n");
    
fclose($fd);
}

//Implimentation
define("LOGFILE","c:\phpLogFile.txt")

log(LOGFILE,"Executing a part of the script, relevant information: ");
?>
This will let you know what is running when, you will then be able to find the snag and we can work from there.
__________________

Village Idiot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get PHP 5. to work? Newbie windows PHP guy DotNetTim Absolute Beginners 11 02-01-2013 11:02 AM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
what are all the subjects in php? sarmenhb General 7 01-21-2008 05:41 PM
PHP Tutorial Section Up and Running CreativeLogic News and Announcements 4 06-01-2005 06:32 PM


All times are GMT. The time now is 03:27 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design