Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-09-2006, 04:09 PM
|
#1
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Rep:
|
Using PHP, run bash script and see results on Server's Monitor
Hello, I'm making a digital picture frame out of an old laptop and I'm setting up Gallery (a php photo gallery organizer) so that I can manage the photos via a nice web interface. I want to add a few links to the php site so that you can start/stop/turnoff/etc the picture frame.
How do I run those already configured scripts that lie on the server?
-Thanks
|
|
|
|
10-10-2006, 07:06 AM
|
#2
|
|
Member
Registered: Aug 2006
Posts: 147
Rep:
|
As far as I know, php can only send output to one interface at a time. However, you can shell to an external program (which can even be a php script if your system is configured to run php scripts from the command line and php is in the path... This is very confusing and nobody does it that way.)
Your laptop "server" should already be set u to allow the exec family of functions, configured in php.ini but it might conceivably be disabled on some systems.
There are lots of ways to do this. You can, for example, write a copy of the album and then exec ('htmlview file://album.php'); to cause a web page to pop up that file on the server's screen... Or you could make it an auto-refreshing page and simply update it now and then... Or you could put the contents in a database and updated the database. Same effect.
I did something similar on my site, only I have it where visitors can draw a picture using javascript, which is saved in a database. From there the image data is sent via serial cable and displayed on an electronic sign for all to see. Naturally, some people will draw dirty pictures but the detail is not that great.
BetaBrite™ Graphical Guestbook: Display your message on our sign.
http://thenerdshow.com/betaimg.php?image=20
|
|
|
|
10-10-2006, 11:50 AM
|
#3
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Original Poster
Rep:
|
I guess, more or less, it's not really a php script that will run serverside, it's just a link on the php page that when clicked will run a bash script (or something similar) on the server. I'd be able to reboot the server, shutdown, and do lots of things via this function, even open a firefox browser on the server (which is logged in as one of its users and running X)
-I think you have the idea, but what would I do to run my ".sh" script for example?
-Thanks
|
|
|
|
10-11-2006, 06:03 PM
|
#4
|
|
Member
Registered: Aug 2006
Posts: 147
Rep:
|
Sounds like you want to administer a server remotely. Try www.webmin.com
|
|
|
|
10-11-2006, 06:48 PM
|
#5
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Original Poster
Rep:
|
Well, sort of. You see, i'm giving this as a gift to my parents and they don't know too much about computers, so I want to just have a page they can open (maybe type in a user and pass) and then be able to do a few simple tasks such as start a slideshow on the digital picture frame (there will be multiple slideshows they can run). Or let them run my little script that turns on/off the lcd (not shutdown/standby), or similar stuff like that.
I want to have like 3-4 tasks/scripts they can just click on and have the server run those processes/scripts. No interface needed because it would all be preconfigured. Webmin seems great, but way too complex for them to use.
Any ideas? Can I simplify webmin to do these things and sort of hide it from their view?
-Thanks
|
|
|
|
10-12-2006, 12:56 AM
|
#6
|
|
Member
Registered: Aug 2006
Posts: 147
Rep:
|
You didn't read the link I gave you in my first reply. PhP's exec function will let you run whatever scripts you want. Check into it and be sure to read the warnings: http://us2.php.net/function.exec
It's easy. Make a page with the exec function. Make another page with the button to press. Have the link in the button go to the page. I thought the php manual covered this topic pretty thoroughly but if you have any more questions there are plenty of people on this forum who can help out. Some of them will even write it for you. Alas, I must go work to feed the family.
|
|
|
|
10-17-2006, 01:28 PM
|
#7
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Original Poster
Rep:
|
OK, I read it over a few times, and now i get it.
Pretty cool I must admit.
-Thanks for the help.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:56 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|