LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-13-2004, 02:55 PM   #1
monzter
LQ Newbie
 
Registered: Aug 2004
Posts: 4

Rep: Reputation: 0
PHP pass argument to shell script


I try to pass argument to shell script with PHP
It not work!

I try

<?
shell_exec("mk_dir.sh /home/test");
?>

on PHP

and

#!/bin/sh
mkdir $1

on shell script

Shell can work console but not work when I run with PHP

What wrong with me?
and what should I do?
or I need to setup something on my RH9 server ?

pls tell me thank
 
Old 08-13-2004, 04:10 PM   #2
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
lookout for help in
'escapeshellargs' function
in PHP and try using 'passthru' functions in PHP

then u can execute ur commads with arguments in them
regards
 
Old 08-14-2004, 06:16 AM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Also make sure that the script you are trying to run is in the PATH for php. Try using the full path.
 
  


Reply


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
how to pass a row to another PHP script bahadur Programming 5 12-24-2011 01:07 AM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
Procmail: match pattern then pass to shell script essdeeay Linux - Software 1 11-08-2004 02:19 PM
How to pass arguments from $prompt for php script ukjairaj Linux - Software 4 06-25-2004 11:14 AM
PHP Script argument passing error... lokee Linux - Software 5 04-24-2003 09:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:10 AM.

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