Running shell script using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
urnetmate
Forum Commoner
Posts: 27
Joined: Wed Sep 27, 2006 1:09 am

Running shell script using PHP

Post by urnetmate »

hello all,

i have to execute commands for creating directory and switching to tht dir then connect ftp and execute a bunch of commands using shell script.

how do i do this using PHP?

waiting for solution.
thx in advance.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

Code: Select all

shell_exec
Be sure to use

Code: Select all

escapeshellarg
on any input from the user or else a user has access to what commands they like (that the web server has access to).
urnetmate
Forum Commoner
Posts: 27
Joined: Wed Sep 27, 2006 1:09 am

Plz can u give an example?

Post by urnetmate »

thx for the reply

Plz can u give an example?
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Running shell script using PHP

Post by Kieran Huggins »

urnetmate wrote:waiting for solution.
Image
urnetmate
Forum Commoner
Posts: 27
Joined: Wed Sep 27, 2006 1:09 am

error Passive mode refused

Post by urnetmate »

I am getting error "Passive mode refused" on mget shell command

Please help..
waiting for solution.

Thanks in Advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're trying to connect to an FTP server, yes? Why not use PHP's FTP functions?

http://php.net/ref.ftp
Post Reply