Reputation: 144
I need to reduce the loading time of a page that has to load a thousand files to make a ranking by starting a script manually but without loading it (like a cron job started manually).
Is there a way to do that using PHP?
Upvotes: 0
Views: 69
Reputation: 950
Assuming that you want to start a script execution when the user wants in the background you could use php exec(); example:
<?php
$cmd = "php /path/to/php/script/ &> /dev/null &";
exec('/bin/bash -c "' . addslashes($cmd) . '"');
(Not 100% positive on the syntax for the $cmd it could be /usr/bin/php or something similar or it could be php5 depending on your system.)
Upvotes: 1
Reputation: 4330
You can run php from shell with "php filename.php" and you can do this with a cron job. But I'm not sure if that is what you want maybe have a look at opt cache to make your site faster.
Upvotes: 0
Reputation: 305
can you elaborate a bit more on that? you could always run a cron job for your php script if you have an apache server
Upvotes: 0