PHP Automated Administrivia?
wikinerd asks: "I am sure all of you know what PHP is and many of you may even use it on your websites, like me. Some of you may have read a this article from Linux.com article that gives some examples on how to use PHP to automate your server administration tasks (or to say it with one word: administrivia). I wonder whether there are any Slashdot users that have already used PHP in their administrivia, and what the results are. Is PHP appropriate for this task? If you have written useful PHP scripts, would you consider to publish their source code here? I am sure that posting your scripts can be beneficial to many new (and old) admins, so let's share our work!"
I've never run into problems with memory leaks, but PHP is still not designed to really be a shell scripting language. The biggest issue I get is "PHP Fatal error: Unable to start session mm module in Unknown on line 0" from cron jobs. Apparently you can't start two instances of PHP at the exact same time, or you get this problem. The only fix I could find was to wrap each PHP script in a SH script as so:
/usr/local/bin/some_script.php
#!/bin/sh
RET=1; while [ $RET != 0 ]; do
RET=$?; done
very dirty, but it ensures the script is attempted to be run forever until it finally doesn't fail to start up the PHP engine. 95% of the time the scripts run fine the first time, and the rest of the time they spit out the above error once and run just fine the second time. I log all of the cron output and thats all I ever see is this PHP error now a few times a week.
Morphing Software
In my experience, reporting bugs to PHP is a pretty pointless endeavor.
I needed ONE simple function and of course, it's broken on freebsd, and the ticket hasn't been touched since it was assigned in august... =\