Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 05-24-2006, 04:05 AM   #1
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Rep: Reputation: 30
Can I execute a shell script from inside a php one.

Hi friends,
I was wondering whether it is possible to somehow execute some shell script from inside a php script ?
Ok, the scenerio is like this.

I have portal for my organisation, and the same is available from the intranet. The authentication is done by a user table that I have created and that stores the passwords in a sha1 hash.
Now, there are some services that I am makeing available to my users and these utilise the system account for the users.

Now when my user changes his password through the portal, I want to change the password in the user table as well as the system account. The first part is not a problem and is working as of now. I want a shell script to change the system password at the same time.

Can it be done ?

Thanks a lot.

Prabhat Soni
Old 05-24-2006, 04:13 AM   #2
Registered: May 2006
Location: India
Distribution: Redhat
Posts: 49

Rep: Reputation: 15
You can use system("/bin/bash")
hope helps
Old 05-24-2006, 05:40 AM   #3
Registered: May 2006
Distribution: Gentoo
Posts: 54

Rep: Reputation: 15
You can also just type the command in backticks (not single quotes) like so

$mystring = `uname -a`
echo $mystring


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
execute shell command inside of c code? khucinx Programming 6 10-26-2010 09:30 PM
Trying to execute a shell-script using php but chown does not work stormrider_may Programming 15 04-11-2006 08:59 PM
Execute shell script using php on linux vj123 Programming 2 02-21-2006 12:41 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM
execute shell command inside of tcl file khucinx Programming 1 07-05-2004 01:29 PM

All times are GMT -5. The time now is 04:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration