LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 07-07-2010, 11:29 AM   #1
linuxfreak3
Member
 
Registered: Feb 2004
Location: UK
Distribution: Debian/Backtrack
Posts: 55

Rep: Reputation: 15
PHP script wont execute


PHP Code:
<?
exec
("./zipalign -v 4 update.zip update4.zip");
?>
this script wont work on my server for some reason
can anyone see whats wrong with it?
i want it to run that file and its in the right folder with the right permissions.
 
Old 07-07-2010, 01:18 PM   #2
delite
Member
 
Registered: Nov 2008
Posts: 50

Rep: Reputation: 15
Try using popen to capture the result...

http://www.rawstar7.co.uk/docs/view/186
 
Old 07-07-2010, 02:02 PM   #3
linuxfreak3
Member
 
Registered: Feb 2004
Location: UK
Distribution: Debian/Backtrack
Posts: 55

Original Poster
Rep: Reputation: 15
Thanks!
it worked :O for some reason with this the command worked
Quote:
function exe($cmd){
$aret=array();
if(!$f=popen($cmd,'r')){return null;}
while(!feof($f)){
$o=fgets($f,1024);
$aret[]=$o;
}
pclose($f);
return $aret;
}

$a=exe('./zipalign -v 4 update.zip update4.zip');
foreach($a as $e){
print $e."<br />";
}

edited it to remove the output and now its fine
 
  


Reply



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
PHP Script Does Not Execute Ukee Linux - Server 5 02-24-2008 08:00 PM
execute php script by a time () afbase Linux - General 1 12-30-2006 03:30 PM
How to Execute PHP Script? notooth Linux - General 2 06-02-2005 05:43 AM
execute php script from /etc/ppp/ip-up tomcontr Programming 1 11-12-2004 01:19 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM

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

All times are GMT -5. The time now is 04:49 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