I was looking at this post which is where I got the idea to use screens to execute my php scripts on the server: Running a PHP script completely on server side
I was successfully able to execute a php script using:
screen
php ./file.php
However, this did not work for me:
screen ./file.php
And it was that last way of doing it that was recommended in that post I linked.
All it says is: Cannot exec './file.php': Permission Denied
sudo screen ./file.php
did not work either.
You have to pass screen
a shell command that works.
You had a shell command that works in your first attempt.
You then removed part of it when you tried to pass it to screen
. Don't do that. Leave the command intact.
screen php ./file.php
If you want the PHP script to be executable directly (i.e. without passing it as an argument to the php
command line binary) then you need to:
#!/usr/bin/env php
)chmod u+x file.php
)