Metonmuris Posted December 18, 2006 Share Posted December 18, 2006 I have created some GD2 generation scripts that only need to be updated everyonce an while, and because they can take some heavy cpu time I would only like them to run when they have changed and not whenever any visits the image.So I set up a script that calls all of the graphics generators as functions and logs the result (Success/Fail) into a log database.[code=php:0]$doPieGraph = 0;$doPieGraph = $_GET['piegraph'];include("../../jpgraph/jpgraph.php");include("../../jpgraph/jpgraph_bar.php");include("../displays/graph_utilities");include("../displays/killratio_chart.php");include("../displays/killratio_map.php");include("../displays/killratio_piechart.php");include('../../config/mysqlvars.php');$query = array();if(DrawKRMap($mysqlvars)){ array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '100', NOW( ) , '0', 'Kill Ratio Map Successfully Updated');"); echo "true KRMAP <br/>";}else{ array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '100', NOW( ) , '1', 'Kill Ratio Map ERROR');"); echo "false KRMAP <br/>";} if(DrawKRGraph($mysqlvars, '../../assets/graphs/killVdeath.png')){ array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '101', NOW( ) , '0', 'Kill Ratio Chart Successfully Updated');"); echo "true KRCHART <br/>";}else{ array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '101', NOW( ) , '1', 'Kill Ratio Chart ERROR');"); echo "false KRCHART <br/>";}if($doPieGraph == 1){ if(DrawKRPieChart($mysqlvars)) { array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '102', NOW( ) , '0', 'Kill Ratio Pie Graph Successfully Updated');"); echo "true KRPIE <br/>"; } else { array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` ) VALUES ('0', '102', NOW( ) , '1', 'Kill Ratio Pie Graph ERROR');"); echo "false KRPIE <br/>"; }}$link = mysql_connect($mysqlvars['host'], $mysqlvars['user'], $mysqlvars['pass']);mysql_select_db($mysqlvars['db']);for($i =0; $i < count($query); $i++){ mysql_query($query[$i]);}mysql_close($link);echo "??????";[/code]Now the scripts works when dealing with DrawKRMap(), but as soon as it gets to DrawKRChart() is stopped outputting the debug echos and ends like it worked. This is more or less the result that the DrawKRChart() uses JpGraph, whereas DrawKRMap() is straight GD2.This doesn't work, so I am sitting here scratching my head trying to figure out how to do this, then I though why not do a CLI operation... Well that doens't work either, because I don't have access to it on my host >:(So my question is there a way to get php to poke/fork another php file in the same way a user would by visiting that php page without using system or php-cli. Link to comment https://forums.phpfreaks.com/topic/31044-solved-running-other-php-scripts-within-a-php-script-wo-shell-access/ Share on other sites More sharing options...
trq Posted December 18, 2006 Share Posted December 18, 2006 Maybe running a cron? But I guess you don't have access to that either huh?this is th beuty of running your own servers. Link to comment https://forums.phpfreaks.com/topic/31044-solved-running-other-php-scripts-within-a-php-script-wo-shell-access/#findComment-143327 Share on other sites More sharing options...
Metonmuris Posted December 18, 2006 Author Share Posted December 18, 2006 I have access to cron.. So I guess the best way would be to tell it to update the files at 2:00am/2:00pm instead of whenever the data get's updated.That's not that bad of an idea, thanks. Link to comment https://forums.phpfreaks.com/topic/31044-solved-running-other-php-scripts-within-a-php-script-wo-shell-access/#findComment-143492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.