icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Using Php's Exec Command

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Closed Thread
 
LinkBack Thread Tools Search this Thread Rate Thread
Old July 19th, 2003, 11:38 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Jun 2003
16 posts
Gave thanks: 0
Thanked 0 times
Hi there, I am trying to use the exec command in php to run a perl script that generates random content. The script is 'Nonsense' (http://nonsense.sourceforge.net) It works fine on my local server, where all i need to do is the following:

Code:
$output = exec("nonsense/nonsense Person");
This should execute the perl script 'nonsense' in the folder 'nonsense' with the argument 'Person'.

This simply returns an empty string on the surpass server. I have tested nonsense itself by running it as cgi directly via the url, ie (http://zaphoyd.com/cgi-bin/nonsense/nonsense) and that works fine. I can exec other stuff like ls -l or pwd or other basic commands. Any ideas? Would Linux handle the exec command differently than the Mac OS X/FreeBSD server I use here?

Thanks a bunch
-Peter
__________________
-Peter Thorson
Zaphoyd Graphics and Software
www.zaphoyd.com
[server vega]
zaphoyd is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old July 19th, 2003, 1:31 PM   #2 (permalink)
Registered User
Seasoned Poster
 
Joined in Jul 2003
Lives in Research Triangle Park, NC / Blacksburg, VA
57 posts
Gave thanks: 0
Thanked 0 times
Quote:
Originally posted by zaphoydJul 19 2003, 9.38 am
Hi there, I am trying to use the exec command in php to run a perl script that generates random content. The script is 'Nonsense' (http://nonsense.sourceforge.net) It works fine on my local server, where all i need to do is the following:

Code:
$output = exec("nonsense/nonsense Person");
This should execute the perl script 'nonsense' in the folder 'nonsense' with the argument 'Person'.

This simply returns an empty string on the surpass server. I have tested nonsense itself by running it as cgi directly via the url, ie (http://zaphoyd.com/cgi-bin/nonsense/nonsense) and that works fine. I can exec other stuff like ls -l or pwd or other basic commands. Any ideas? Would Linux handle the exec command differently than the Mac OS X/FreeBSD server I use here?

Thanks a bunch
-Peter
The system might not be recognizing the file as a perl file correctly. Is there a #!/usr/bin/perl at the beginning of your script? If not I'd add it and that might solve your problem.

If that doesn't work, try calling the perl interpreter directly through an exec. Like:

$c = exec('/usr/bin/perl /home/yourname/public_html/nonsense/nonsense Person');
__________________
"I tried to go to Target but I missed" ~Mitch
VTJustinB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On