launching php script as root from command line

1

How can I execute php script as root user? I tried: sudo ./script.php

and in my script I've got at 1 line: #!/usr/bin/php

Krystian

Posted 2013-03-21T11:56:13.653

Reputation: 157

So, what happens when you run it like that? – Der Hochstapler – 2013-03-21T12:20:25.210

Answers

0

If I've understood correctly, you shouldn't need #!/usr/bin/php in your PHP script. Presuming you've got php installed with the command available, try the below from command line:

sudo php path/to/script.php

...where script.php contains only PHP code.

OmidTahouri

Posted 2013-03-21T11:56:13.653

Reputation: 711