Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

exec()

Recommended Posts

OK

I have linux (seems relevant LOL)

if I do this from the command line:

root# php myfile.php

it executes this fine:

myfile.php

<?php
exec(xmame romfile);
?>

and xmame launches fine.

BUT
if I run the same from the browser, it doesn't give an error, but doesn't run.

QUESTION:

Is is possible to launch a executable from the browser? or must I learn another language? (perl?)

(My goal is to write a front end for xmame that uses the web browser, php and mysql)

It would have to be run locally obviously

thanks

Share this post


Link to post
Share on other sites
I don't understand when someone says command line, all I deal with is host based php/mysql programming, I never ran it from a straight server, as for exec, it should work, if not I think system()
there about the same, the main thing is though don't feed user input into system it's dangerous.

Share this post


Link to post
Share on other sites
php probably isn't in apache's path. Something simple like pwd should work:

[code]
<pre>
<?php
exec('pwd', $output, $return);
echo "Returned: $return<br /><br />";
if ($return) {
echo 'There was a problem.';
}
else {
echo "Output:<br />";
print_r($output);
}
?>
</pre>
[/code]

Try replacing 'pwd' with 'env' to see your PATH. You can also try specifying the full path to php.

Share this post


Link to post
Share on other sites

×

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.