Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
by penguino » Tue Oct 30, 2012 3:54 am
hello, i would lilke to create a page with links that will run sh files (bash scripts), for personal use.
I have installed lampp on my linux machine and able to run php files on it.
I'm not familiar with php and had no luck so far with getting it done.
Thank you.
-
penguino
- New php-forum User

-
- Posts: 8
- Joined: Mon Oct 29, 2012 9:42 am
by penguino » Tue Oct 30, 2012 4:11 am
An html file to run the php in a link
- Code: Select all
<html>
<title></title>
<a href="2.php">run tmp.sh</a>
</html>
and the php file
- Code: Select all
<?
exec('sh tmp.sh');
?>
and finally the sh file which just prints out a line in the terminal.
But nothing happens when i press on the link
-
penguino
- New php-forum User

-
- Posts: 8
- Joined: Mon Oct 29, 2012 9:42 am
by penguino » Tue Oct 30, 2012 5:35 am
thank you for the reply, however i'm not sure i got this..
do i need to copy the sh file to the /bin/bash folder for it to run through the php?
and why what you wrote has to run two php files?
-
penguino
- New php-forum User

-
- Posts: 8
- Joined: Mon Oct 29, 2012 9:42 am
by penguino » Tue Oct 30, 2012 7:33 am
Still trying unsuccessfully... anyone?
-
penguino
- New php-forum User

-
- Posts: 8
- Joined: Mon Oct 29, 2012 9:42 am
by penguino » Tue Oct 30, 2012 1:00 pm
i got it to run the sh file and commands like echo runs ok, however background processes and programs can't be run and gives: "cannot open display" error..
-
penguino
- New php-forum User

-
- Posts: 8
- Joined: Mon Oct 29, 2012 9:42 am
Return to PHP coding => General
Who is online
Users browsing this forum: Google Feedfetcher, maideen and 4 guests