Unable to start VNC server from PHP










0














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










share|improve this question























  • 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















0














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










share|improve this question























  • 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













0












0








0







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










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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












2 Answers
2






active

oldest

votes


















0














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





share|improve this answer






















  • 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


















0














There's 3 things that need to be done:




  1. Change your permissions in /etc/X11/Xwrapper.config to be the following:



    allowed_users=anybody



  2. Add a home directory to the script: ex: export HOME=/var/www/


  3. Add a user variable to the script: ex: export USER=www-data






share|improve this answer




















    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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





    share|improve this answer






















    • 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















    0














    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





    share|improve this answer






















    • 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













    0












    0








    0






    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





    share|improve this answer














    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






    share|improve this answer














    share|improve this answer



    share|improve this answer








    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
















    • 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













    0














    There's 3 things that need to be done:




    1. Change your permissions in /etc/X11/Xwrapper.config to be the following:



      allowed_users=anybody



    2. Add a home directory to the script: ex: export HOME=/var/www/


    3. Add a user variable to the script: ex: export USER=www-data






    share|improve this answer

























      0














      There's 3 things that need to be done:




      1. Change your permissions in /etc/X11/Xwrapper.config to be the following:



        allowed_users=anybody



      2. Add a home directory to the script: ex: export HOME=/var/www/


      3. Add a user variable to the script: ex: export USER=www-data






      share|improve this answer























        0












        0








        0






        There's 3 things that need to be done:




        1. Change your permissions in /etc/X11/Xwrapper.config to be the following:



          allowed_users=anybody



        2. Add a home directory to the script: ex: export HOME=/var/www/


        3. Add a user variable to the script: ex: export USER=www-data






        share|improve this answer












        There's 3 things that need to be done:




        1. Change your permissions in /etc/X11/Xwrapper.config to be the following:



          allowed_users=anybody



        2. Add a home directory to the script: ex: export HOME=/var/www/


        3. Add a user variable to the script: ex: export USER=www-data







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 '18 at 23:25









        kristopolous

        81921019




        81921019



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党