I have dug through everything I can find on the topic of starting a screen from PHP. I'm starting a game server, so I must run it from a specific user so that the server executable looks in the right folder for its other files. I have changed Apache's user from its default to the user I must run the server from. When I have
exec('cd /User/FolderWithScript && bash script.sh); to emulate what I would do to start it, it doesn't report any errors in /var/log/apache2/error.log, but also doesn't start the server or its screen.
The same thing happens if I were to use
exec('cd /User/FolderWithExecutable && screen -dmS ServerExcutable +Args'); which is essentially what the script does.
If I use
exec(cd /User/FolderWithScript && bash ServerExcutable +Args); it spits out all of the usual stuff for the server in /var/log/apache2/error.log, but unfortunately also appears to be looking in the wrong directory for most of the game files, which are located in /User/.game.