Jump to content

morleypotter

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by morleypotter

  1. well the error was: Error: display: unable to open X server `' @ display.c/DisplayImageCommand/422. So i thought that i may need to start another x session which is why i tried 'startx'
  2. I've made a small amount of progress amending an example on the manual page but i was wondering if anyone could 'tweak' this code to get it to work. 1st the code then the output. <?php exec('TERM=xterm display localhost:0.0 /usr/bin/firefox n 1 b i', $xterm, $error ); echo nl2br(implode("\n",$xterm)); if ($error){ exec('TERM=xterm display localhost:0.0 /usr/bin/firefox n 1 b 2>&1', $error ); echo "Error: "; exit($error[0]); } ?> I tried adding 'startx' in various places but it just makes the page hang? Any help would be greatly appreciated.
  3. Yeah, i tried that before, but it did the same thing, i have also read the manual but i'm not sure what other arguments to pass to it as i simply want it to open the application not do anything in particular?
  4. Hi Thorpe, I tried it but it only made a blank line, when i change the word 'firefox' with 'ls' for example it then produces a result so i'm sure i've done it right? <?php echo "Firefox Launch Test"; echo "</br>"; $output = shell_exec('firefox'); echo "<pre>$output</pre>"; if ($output === "0") { echo "working...."; } else { echo "Firefox Launch Test Failed!"; } echo "</br>"; echo "whoami query = "; echo (`whoami`); ?>;
  5. Thanks Thorpe - Couldn't find that info anywhere, i was looking at suPHP when i noticed your post. Here are the results of ps aux | grep apache which means i've changed it properly this time.... And my code which is this still doesn't work? echo "Firefox Launch Test"; echo "</br>"; echo "</br>"; $output = `/usr/bin/firefox`; if ($output === "0") { echo "working...."; } else { echo "Firefox Launch Test Failed!"; } I'm so frustrated i thought i was onto a winner when you told me how to change the user Apache runs as.
  6. Thanks Thorpe, you are right it does now display "failed" as you suggest, as to why i thought it a good idea to pass it again to exec - i have no idea. The code i have below therefore isn't even attempting to launch firefox, i have also added the /usr/bin path to it to see if that helps but nothing, oh well, i'll try some more googling to see how to give those rights to Apache. I have just ran a echo exec('whoami'); the response being 'www-data' [which i understand is Apache] so i've done something wrong whilst trying to get Apache to run as the current user. <?php echo "Firefox Launch Test"; echo "</br>"; echo "</br>"; $output = `/usr/bin/firefox`; if ($output === "0") { echo "working...."; } else { echo "Firefox Launch Test Failed!"; } ?>
  7. Hi Thorpe, I changed the code and now it's reporting "working", so i assume that when i figure out how to give the sufficient rights to Apache it should launch the application? OR Because i added the 'if' statement to see if it was actually doing anything the code will now not launch the application? Apologies if this doesn't make sense, i think i've confused myself now! :-\ echo "Firefox launchtest2"; echo "</br>"; echo "</br>"; $output = `firefox`; $doit2 = exec($output); if ($doit2 == "0") { echo "working...."; } else { echo "Firefox Launch Test 2 Failed!"; } ?>
  8. Just a quick update on the code i'm using now (will this work once i've gotten Apache to run as the current user) <?php echo "test1"; // shell_exec can return results and print them $launcher = shell_exec('ls -lart'); echo "<pre>$launcher</pre>"; // now to try and launch an application echo "Firefox launchtest1"; echo "</br>"; echo "</br>"; $launcher = exec('firefox'); if ($launcher == "1") { echo "working...."; } else { echo "Firefox Launch Test 1 Failed!"; } echo "</br>"; echo "</br>"; echo "Firefox launchtest2"; echo "</br>"; echo "</br>"; $output = `firefox`; $doit2 = exec($output); if ($doit2 == "1") { echo "working...."; } else { echo "Firefox Launch Test 2 Failed!"; } ?> Which produces.... test1 total 16 drwxr-xr-x 2 root root 4096 May 25 16:54 webalizer drwxr-xr-x 16 root root 4096 May 25 16:54 .. -rw-r--r-- 1 root root 579 Aug 11 13:49 index.php drwxr-xr-x 3 root root 4096 Aug 11 13:49 . Firefox launchtest1 Firefox Launch Test 1 Failed! Firefox launchtest2 Firefox Launch Test 2 Failed! -- Thanks again.
  9. Thanks again Thorpe, i have read somewhere that it is the normal practice to add the user to the www-data group, which i have done and re-ran the nautilus scripts above but nothing seems to be happening? I fear i may miss understand? Could you (or anyone willing) please advise on how I would make Apache execute as the current user? Thanks.
  10. Hi Thorpe, Firstly thank you for your help, i have read up on suEXEC which isn't (i think) the right tool for the job as there will only be one user on the live cd, [who i will probably make root as nothing can be written to a cd to break anything once i'm finished]. I have posted on ubuntuforums.org as well and what feedback i had from them suggests as you say it is theoretically possible, but nobody seems to actually know how to do it. I'm now changing my train of thought and thinking of writing shell scripts to open the applications and using php to 'activate' the script - is this possible do you think? Again thanks for your help.
  11. Hi Everyone, I REALLY need some help please before I go mad. As the subject of this post suggests i'm trying to launch Ubuntu applications from a php script, i have tried different ways of doing this but without much success. Firstly i would like to explain why and maybe somebody may have a better suggestion or an alternative route... I am making a 'personal' remix of Ubuntu which will be a live CD i can use for my university work (studying computer forensics), it will basically be a minimal install with every Linux based forensics application i can lay my hands on, instead of having a huge list of shortcut's in the menu's that ship with Ubuntu I though it would be fun/a challenge to make a fancy PHP based web site which contained a database of the programs so i could search through them and find what i need by category ect and then launch those applications from the same site. I can 'talk' to Ubuntu through some small scripts i've tried but i can't launch any applications. Here is what i've got so far.... <?php echo "test1"; $launcher = shell_exec('ls'); print "<pre>$launcher</pre>"; echo "test2"; $output = exec(ls); $doit2 = exec($output); print "<pre>$doit2</pre>"; echo "test3"; $cmd = 'ls'; echo "<pre>".shell_exec($cmd)."</pre>"; ?> Which outputs.... test1 index.php webalizer test2 Webalizer V2.01-10 (Linux 2.6.32-24-generic) locale: C test3 index.php webalizer Sucess i thought, so i then tried using the same formats to launch nautilus as a test, all of the below produced no results... <?php echo "test1"; $launcher = shell_exec('/usr/bin/nautilus'); print "<pre>$launcher</pre>"; echo "test2"; $output = exec(/usr/bin/nautilus); $doit2 = exec($output); print "<pre>$doit2</pre>"; echo "test3"; $cmd = '/usr/bin/nautilus'; echo "<pre>".shell_exec($cmd)."</pre>"; ?> Can anybody please help me out, i've searched all over these forums, php.net and googled endlessly. Any advice would be greatly appreciated Many thanks, MorleyPotter
  12. Thanks for your reply, that is one possibility - the only thing is i don't think i could really call it my own if i did it that way. Ideally i'd like to do it from scratch to be honest.
  13. Hi Everyone, I'm thinking of producing a website for a project at uni which would resemble the Ubuntu brainstorm website [here: http://brainstorm.ubuntu.com] I plan to write it in PHP (obviously) with a mysql database, does anyone have any ideas on how i could start to plan such a project, suggest any PHP frameworks which may make the job easier, any code already available to start me off etc?? Any help would be greatly appreciated & apologies if this is in the wrong place (i'm new to this sort of thing) morleypotter.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.