Suppose you have a PHP script with the following contents (simple example here):
<?php phpinfo(); ?>
To enable the Job Scheduler to execute this script directly, we need make only two changes to the script. First, add one line to the top of the script:
#!/usr/bin/php <?php phpinfo(); ?>
Note that the first line is an interpreter directive, which tells the operating system which program to load.
Secondly, make this file executable with: chmod u+x info.php
You also can add the script directly to the job definition instead of using a separate file.
<?xml version="1.0" encoding="ISO-8859-1"?> <job name="job_execphp"> <script language="shell"> <![CDATA[ #!/usr/bin/php <?php phpinfo(); ?> ]]> </script> <run_time/> </job>