static text generation
Moderator: General Moderators
Argh.dave420 wrote:PHP is a language, and the PHP software is an interpreter. The interpreter can't just gain consciousness and start running bits of code all on its own - it has to be called by something else. If you want PHP to run at a certain time, something has to run PHP at a certain time. PHP code can't just run itself. Neither can perl, java, C, C++ or anything else. Your gripe seems to be with a lack of cross-platform admin-less scheduling software, not a shortcoming with PHP.
Third time I'll try to explain the concept to you.
Apache runs as a daemon. Mod_PHP is a module, that Apache can call.
Now, someone accesses a script - a PHP script - which Apache sees, and loads Mod_PHP to process it. No "gaining conscience" needed.
The script contains a command. Lets call it schedule_task(). Schedule_task in turn tells APACHE to - at specific times - use mod_php to process particular scripts, processes, commands, what have you.
Apache runs as a daemon, so it can check a command stack at regular intervals (its not event-driven). The command stack can be as simple as "there is something on the stack, refer to mod_php". mod_php in turn can hold a command stack as simple as "check with script.php". script.php could then hold the scheduled commands.
None of that is a tremendous change from their current operating manner - and none of it is possible today in PHP, which is what the poster asked for.
Please stop attacking me for answering (from experience, and from a genuine need) what the poster asked.
He asked what PHP doesnt have, but could use. I answered. There is no cross-platform solution to this problem, and there could be by modifying PHP (and possibly, slighly, Apache).
First off, I'm not attacking anyone! Believe me, it's not an attack. Not even close. I applaud anyone who spends their time helping others.
Your solution follows exactly what I've been saying - using APACHE to be the scheduler. PHP can't do it, as PHP isn't running all the time.
There is no way a slight modification to PHP could yield what you want. You need a modification to the Apache server, which shows it's not a problem with PHP, but with Apache.
The fact it's nigh-on impossible to create cross-platform scheduled tasks isn't something wrong with or missing from PHP, but the environment in which it runs. Because you want this scheduler to run PHP scripts doesn't mean it's shortcoming in PHP, but where you choose to run it
Your solution follows exactly what I've been saying - using APACHE to be the scheduler. PHP can't do it, as PHP isn't running all the time.
There is no way a slight modification to PHP could yield what you want. You need a modification to the Apache server, which shows it's not a problem with PHP, but with Apache.
The fact it's nigh-on impossible to create cross-platform scheduled tasks isn't something wrong with or missing from PHP, but the environment in which it runs. Because you want this scheduler to run PHP scripts doesn't mean it's shortcoming in PHP, but where you choose to run it