You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

launchd and PHP

I'm trying to get launchd to launch a php script in the WebServer/Documents/ folder of our server. I need the script to run every 6 hours and have been using lingon to create the plist files. I know there are issues with times and dates with launchd but I can't even get the script to run once. Does launchd work with PHP and Apache? If not, what should I look into.

Thanks for any advice you can offer!

PowerMac G5, Mac OS X (10.4.10)

Posted on Oct 3, 2007 7:54 AM

Reply
9 replies

Oct 4, 2007 7:00 AM in response to jaydisc

here is the plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.curaelase.phpreply</string>
<key>ProgramArguments</key>
<array>
<string>/Library/WebServer/Documents/curaelase.com/includes/messages.php</strin g>
</array>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>

I think I am very lost! Thanks for your help.

Oct 8, 2007 7:13 AM in response to jaydisc

the file permissions are set to 777

when i type directly into the terminal i get error messages:
/fullpath/messages.php: line 1: ?PHP: No such file or directory
/fullpath/messages.php: line 3: include: command not found
/fullpath/messages.php: line 4: syntax error near unexpected token `('
/fullpath/messages.php: line 4: `$conn = mysql_connect($database_path, $database_user, $database_pass) or die('Error connecting to mysql');'

when i execute the file via the browser (firefox) it does what is expected with no errors

also i'm working from my local machine, in the meantime i'll upload to the server and test from there (Mac OS X Server 10.4.10)

thanks again for taking the time to help me with this!

Oct 9, 2007 1:41 PM in response to mikeydiamonds

Like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.curaelase.phpreply</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/php</string>
<string>/Library/WebServer/Documents/curaelase.com/includes/messages.php</string>
</array>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>

launchd and PHP

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.