Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I have a server for which I have created a cron job "sendalerts" to users. Mind you this "sendalerts.php" should be runnable from two methods (via browser and also via a cron job)

So cron's job is to execute a php file which then sends the alerts out, something like this:

01 01 * * * /usr/bin/php -f /var/www/vhosts/xxxxx.com/xxx/sendalerts.php

But it keeps failing with the log message:

Could not open input file: /var/www/vhosts/xxxxx.com/xxx/sendalerts.php

So I checked the file group and owner of "sendalerts.php" and realized it was "anothergroup" (since it was created through Plesk filemanager) for which "root" is not a member. I then deleted and recreated "sendalerts.php" from SSH with root. But this would not grant me access to running the same file in browser as I would sometimes want to (manually send the alerts).

Yet I get the same log error when cron tries to execute (Could not open input file: /var/www/vhosts/xxxxx.com/xxx/sendalerts.php)

Currently my possible solution would be to recreate the same file using Plesk filemanager and then add "root" user to the "anothergroup" group .

But for this my question is: would that be a safe and secure thing to do? Considering now the group "anothergroup" may have "root" user permissions (if I'm not wrong in my understanding).

share|improve this question

migrated from webmasters.stackexchange.com Aug 17 '13 at 10:33

This question came from our site for pro webmasters.

1 Answer 1

up vote 4 down vote accepted

Yeah.... your description of the situation makes absolutely no sense at all.

Root is god on a unix system. Root will be able to read, write and execute any file on your system unless you do something wonky with Selinux. The error message does not indicate a permissions problem either.

The situation is mostly like caused by the fact that your PHP script does not have a shebang line so your shell is unable to execute it correctly.

Add #!/bin/env php to the start of your file and it should work.

share|improve this answer
Also, in general it's a bad idea to run scripts like this as root. It probably suffices to have it run as whichever user is logically the owner of the file. –  Stephen Touset Oct 15 '13 at 23:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.