You are here: exec script dies without error - help! « All PHP « IT news, forums, messages
exec script dies without error - help!

Posted by l3vi on 11/29/06 06:28

I have a script that is started via exec("/usr/local/bin/php
../myscript.inc.php ".$gateway." ".$type." > /dev/null &");

80% of the time the script will run and complete its job. However now
and then it will start and just stop anywhere from 0%-100% being done.
The script never gives off any errors, notice, etc. I have turned on
php's logging, and even setup a error handler, as well as tested it
with E_ALL.

The only thing that I have found was a bus error using ps aux in shell
when the script dies.

I have narrowed the bug down to some place around here:
<?
....
foreach($output[1] as $url) {
$text = http_request($url, '', 'GET', 'RAND');
preg_match('|<dat[^>]*set="([^>]+)"[^>]*>|Ui', $text, $regs);
$list= explode(',', strtolower($regs[1]));
$nn++;
foreach($list as $word)
{
if ((strlen($word) < 2) or (strlen($word) > 80))
{ } else
{
if (get_magic_quotes_gpc()==1)
{
$word = html_entity_decode(addslashes(trim(str_replace("\n", "
",str_replace("\r\n", " ", $word)))));
$word = preg_replace("/[^A-Za-z0-9\s\.&\$\#\%]/i", "", $word);
} else {
$word = html_entity_decode(trim($word));
$word = preg_replace("/[^A-Za-z0-9\s\.&\$\#\%]/i", "", $word);
}
$fin_list[trim(ltrim(rtrim($word)))] = $fin_list[$word]+1;
}
}

$procs = (100-str_replace("-", "", round(($nn-$total)/$total*100)));
// UPDATE PROGRESS
if((($nn-$total)/$total*100)%2)
{
if($last_procs != $procs) save_progress($local_database, $sout,
$procs, $today_is);
$last_procs = $procs;
}
}

array_multisort($fin_list, SORT_DESC);
$amount_found = count($fin_list);

if($amount_found<1) {
$fin_list[] = "Nothing Found!";
}

// SAVE RESULTS
...
?>

Or in a NIC manager here:

<?
....
// Ref via http_request function:

function select_bound_ip() {
$file_path = '/NBI/';
$file_name = 'eth0.txt';
while(!$contents) {
$contents = file_get_contents($file_path.$file_name);
}
$bound_ips = @unserialize($contents);
if(!$bound_ips)
{
$bound_ips['IPS'] = explode("\n", $contents);
$bound_ips['MARKER'] = 0;
}
$cur_ip = $bound_ips['IPS'][$bound_ips['MARKER']];
$cur_ip_size = count($bound_ips['IPS'])-1;
$next_ip = $bound_ips['MARKER']+1;
$bound_ips['MARKER'] = $bound_ips['MARKER']+1;
$cur_serlz = serialize($bound_ips);

$fp=fopen($file_path.$file_name, "w+");
fwrite($fp, $cur_serlz);
fclose($fp);
return $cur_ip;
}
....
?>

I have been on this bug for more then 2 weeks, and Im just at ends to
what is the problem. Im having the hosting company take down the box
tomorrow to run hardware testing to see if that could be the problem.

I am running PHP 5.1.6, Apache 1.3.3.7, Zend 2.1.0

HELP!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация