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
  • 157

1 Answers1

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.