php exec()命令无法在服务器上运行php脚本

I have the following command in a php script that is executed after pressing a button on my website:

exec('nohup php /var/www/website.org.uk/myScript.php >> /var/www/website.org.uk/shared/storage/logs/myLog.log 2>&1 & echo $! > /var/www/website.org.uk/pid.txt');

Ideally, on my server it should execute myScript.php, send any output from the script to myLog.log and store the pid of the myScript.php process to pid.txt.

myScript.php:

<?php
print "
Starting dummy script
";
sleep(10); // Sleep for 10 seconds.
print "
Finished dummy script
";

If I ssh into the server and run the command manually, it all works fine. When run from the website however, the pid is written to the pid.txt file, but the php script fails immediately. Nothing is written to the log, and I can't see the process running on the server when using the ps command (I should see it running for at least 10 seconds due to the sleep command).

After reading previous stack overflow posts I changed permissions for all three files to -rwxr-x--- and updated the group to www-data but this didn't made any difference.

Am I missing anything else here?