It's possible, yes. But you shouldn't let a script log in as root user. You could allow a non-/less-privileged user to execute the command using php, so there wouldn't be that much impact if someone got access to the login details stored in the php file.
(see PHP commands like "exec", "system", "passthru", ... for executing system commands.)
But, why aren't you creating a cronjob for root user that executes sendmail -q for you? There's no need to do this in PHP if not absolutely necessary.
__________________
AdultCoding.com Webdevelopment - info [smth] adultcoding [smthelse] com - Skype: AdultCoding
Individual PHP development following the latest standards in the web industry.
Get in touch for a custom offer, now!
|