Results 1 to 6 of 6
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 ...
- 07-07-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 16
php script wont execute
this script wont work on my server for some reasonPHP Code:<?
exec("./zipalign -v 4 update.zip update4.zip");
?>
can anyone see whats wrong with it?
i want it to run that file and its in the right folder with the right permissions.
- 07-07-2010 #2Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 1,939
Have you tried full tags? Change <? to <?php.
- 07-07-2010 #3Just Joined!
- Join Date
- May 2010
- Posts
- 16
yea and its turned on so it should accept <? also
anyways fixed
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 />";
}
used that script
fixed it
- 07-07-2010 #4Linux Newbie
- Join Date
- Apr 2010
- Location
- Novosibirsk, Russia
- Posts
- 136
see phpinfo() - maybe exec() is restricted? Switch on 'display_errors' - it will help you to understand the reason of error :
Code:<?php ini_set(‘error_reporting’, E_ALL); ini_set(‘display_errors’, ‘On’); /* Your code ... */ ?>
- 07-08-2010 #5Just Joined!
- Join Date
- May 2004
- Location
- CO USA
- Posts
- 5
I'd guess permissions since its exec and often webserver can't do that.
- 07-08-2010 #6Just Joined!
- Join Date
- Aug 2005
- Posts
- 5
propably you need to change the directory to where the `zipalign` executable resides in your file system.
Also my advice is to always redirect the STDERR of your commands, like:Code:<?php chdir('/absolute/path/to/my/executable/'); exec("./zipalign -v 4 update.zip update4.zip"); ?>
Code:<?php chdir('/absolute/path/to/my/executable/'); exec("./zipalign -v 4 update.zip update4.zip 2>&1"); ?>


Reply With Quote