Unable to start VNC server from PHP
I'm trying to get PHP to start up vncserver environment before it starts up a gameserver.
if(isset($_POST['start-1']))
putenv('HOME=/home/psych/');
shell_exec('sh /home/psych/mw3/Infected/start.sh');
echo "SERVER 1 STARTED";
when i check my apache logs i get this error every time...
vncserver: The HOME environment variable is not set.
Here is what's in start.sh
vncserver -geometry 1000x800 -depth 24
cd /home/psych/mw3/Infected/
screen -d -m bash -c "export DISPLAY=:1 ; server.exe -param1 -param2";
How can i set HOME or avoid it checking so my php can start the server?
Thanks in advance!
UPDATE:
I went off export HOME=/home/psych
and got this
vncserver: Could not create /home/psych//.vnc.
I then tried export HOME=/
and got this...
vncserver: Could not create //.vnc.
I just need a hand with what comes after HOME=
Cheers
php environment-variables ubuntu-16.04
add a comment |
I'm trying to get PHP to start up vncserver environment before it starts up a gameserver.
if(isset($_POST['start-1']))
putenv('HOME=/home/psych/');
shell_exec('sh /home/psych/mw3/Infected/start.sh');
echo "SERVER 1 STARTED";
when i check my apache logs i get this error every time...
vncserver: The HOME environment variable is not set.
Here is what's in start.sh
vncserver -geometry 1000x800 -depth 24
cd /home/psych/mw3/Infected/
screen -d -m bash -c "export DISPLAY=:1 ; server.exe -param1 -param2";
How can i set HOME or avoid it checking so my php can start the server?
Thanks in advance!
UPDATE:
I went off export HOME=/home/psych
and got this
vncserver: Could not create /home/psych//.vnc.
I then tried export HOME=/
and got this...
vncserver: Could not create //.vnc.
I just need a hand with what comes after HOME=
Cheers
php environment-variables ubuntu-16.04
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36
add a comment |
I'm trying to get PHP to start up vncserver environment before it starts up a gameserver.
if(isset($_POST['start-1']))
putenv('HOME=/home/psych/');
shell_exec('sh /home/psych/mw3/Infected/start.sh');
echo "SERVER 1 STARTED";
when i check my apache logs i get this error every time...
vncserver: The HOME environment variable is not set.
Here is what's in start.sh
vncserver -geometry 1000x800 -depth 24
cd /home/psych/mw3/Infected/
screen -d -m bash -c "export DISPLAY=:1 ; server.exe -param1 -param2";
How can i set HOME or avoid it checking so my php can start the server?
Thanks in advance!
UPDATE:
I went off export HOME=/home/psych
and got this
vncserver: Could not create /home/psych//.vnc.
I then tried export HOME=/
and got this...
vncserver: Could not create //.vnc.
I just need a hand with what comes after HOME=
Cheers
php environment-variables ubuntu-16.04
I'm trying to get PHP to start up vncserver environment before it starts up a gameserver.
if(isset($_POST['start-1']))
putenv('HOME=/home/psych/');
shell_exec('sh /home/psych/mw3/Infected/start.sh');
echo "SERVER 1 STARTED";
when i check my apache logs i get this error every time...
vncserver: The HOME environment variable is not set.
Here is what's in start.sh
vncserver -geometry 1000x800 -depth 24
cd /home/psych/mw3/Infected/
screen -d -m bash -c "export DISPLAY=:1 ; server.exe -param1 -param2";
How can i set HOME or avoid it checking so my php can start the server?
Thanks in advance!
UPDATE:
I went off export HOME=/home/psych
and got this
vncserver: Could not create /home/psych//.vnc.
I then tried export HOME=/
and got this...
vncserver: Could not create //.vnc.
I just need a hand with what comes after HOME=
Cheers
php environment-variables ubuntu-16.04
php environment-variables ubuntu-16.04
edited Jan 26 '17 at 16:24
asked Jan 26 '17 at 15:48
Jake
112
112
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36
add a comment |
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36
add a comment |
2 Answers
2
active
oldest
votes
Does the following work?
shell_exec('export HOME=/home/psych && sh /home/psych/mw3/Infected/start.sh');
Or, try adding (to the beginning of start.sh
):
export HOME
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
add a comment |
There's 3 things that need to be done:
Change your permissions in
/etc/X11/Xwrapper.config
to be the following:allowed_users=anybody
Add a home directory to the script: ex:
export HOME=/var/www/
Add a user variable to the script: ex:
export USER=www-data
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41877399%2funable-to-start-vnc-server-from-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Does the following work?
shell_exec('export HOME=/home/psych && sh /home/psych/mw3/Infected/start.sh');
Or, try adding (to the beginning of start.sh
):
export HOME
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
add a comment |
Does the following work?
shell_exec('export HOME=/home/psych && sh /home/psych/mw3/Infected/start.sh');
Or, try adding (to the beginning of start.sh
):
export HOME
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
add a comment |
Does the following work?
shell_exec('export HOME=/home/psych && sh /home/psych/mw3/Infected/start.sh');
Or, try adding (to the beginning of start.sh
):
export HOME
Does the following work?
shell_exec('export HOME=/home/psych && sh /home/psych/mw3/Infected/start.sh');
Or, try adding (to the beginning of start.sh
):
export HOME
edited Jan 26 '17 at 15:57
answered Jan 26 '17 at 15:54
Nehal J Wani
9,53422446
9,53422446
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
add a comment |
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
Sadly not, It's still the same error
– Jake
Jan 26 '17 at 15:56
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
@Jake I have updated the answer
– Nehal J Wani
Jan 26 '17 at 15:59
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
Thanks, but still no luck.
– Jake
Jan 26 '17 at 16:05
add a comment |
There's 3 things that need to be done:
Change your permissions in
/etc/X11/Xwrapper.config
to be the following:allowed_users=anybody
Add a home directory to the script: ex:
export HOME=/var/www/
Add a user variable to the script: ex:
export USER=www-data
add a comment |
There's 3 things that need to be done:
Change your permissions in
/etc/X11/Xwrapper.config
to be the following:allowed_users=anybody
Add a home directory to the script: ex:
export HOME=/var/www/
Add a user variable to the script: ex:
export USER=www-data
add a comment |
There's 3 things that need to be done:
Change your permissions in
/etc/X11/Xwrapper.config
to be the following:allowed_users=anybody
Add a home directory to the script: ex:
export HOME=/var/www/
Add a user variable to the script: ex:
export USER=www-data
There's 3 things that need to be done:
Change your permissions in
/etc/X11/Xwrapper.config
to be the following:allowed_users=anybody
Add a home directory to the script: ex:
export HOME=/var/www/
Add a user variable to the script: ex:
export USER=www-data
answered Nov 12 '18 at 23:25
kristopolous
81921019
81921019
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41877399%2funable-to-start-vnc-server-from-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you are running the HTTP server with a user who is different than psych, then the second part of your query is probably a permissions issue.
– Nehal J Wani
Jan 27 '17 at 5:36