Problem using system()

General discussion on Zend Server for IBM System i

Problem using system()

Postby raytaylorii on Wed Nov 14, 2012 5:06 pm

I am converting to a new IBM I server and have loaded the latest zend server 5.6. The web application has been moved to the new server and runs fine with the exception of the system() function. I installed the zip/unzip utilities from easy400 dot net. I can run the unzip utility fine from the qp2term interface but not from within PHP. When I use the system() function to run unzip, I get a return value of 50. Can't find anything that tells me what return value 50 means? Any help would be appreciated.
raytaylorii
 
Posts: 27
Joined: Tue Sep 29, 2009 4:35 pm

Re: Problem using system()

Postby raytaylorii on Wed Nov 14, 2012 6:24 pm

To add a little more info, the system() function works fine on our old V6.1 server when running the unzip utility....
raytaylorii
 
Posts: 27
Joined: Tue Sep 29, 2009 4:35 pm

Re: Problem using system()

Postby timo_karvinen on Wed Nov 21, 2012 6:01 pm

I know this doesn't exactly answer your question, but if you're interested in a workaround.

I don't know what could be wrong with system() function, but have you considered using "Zip" extension right there on the php, instead of using external zip/unzip utility using system() call.
Just search php[dot]net for "Zip" and try that or several of the other similar extensions out.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Problem using system()

Postby raytaylorii on Thu Nov 29, 2012 8:18 pm

I think I looked at the zip extensions and they didn't offer support to unzip password protected files...which ours have passwords on them. I will look again at the extensions to see if they would work.
raytaylorii
 
Posts: 27
Joined: Tue Sep 29, 2009 4:35 pm

Re: Problem using system()

Postby timo_karvinen on Fri Nov 30, 2012 10:07 am

There are also several other compression/archive extensions available, if the Zip one doesn't suit your needs you could check those out too.
There's Bzip2, LZF, Phar, Rar, Zip and Zlib that can be found by searching "compression" at php[dot]net.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Problem using system()

Postby timo_karvinen on Fri Nov 30, 2012 10:16 am

Well actually, quick googling would indicate that you are right, probably none of those extensions support password protected files.
So it seems system() / shell_exec() might be the only possibilities.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Problem using system()

Postby timo_karvinen on Fri Nov 30, 2012 10:25 am

Coming back to your original problem then, here's an article that explains system() and similar php commands in some detail:
chipmunkninja . com/Program-Execution-in-PHP%3A-exec-m@

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Problem using system()

Postby aseiden on Wed Dec 05, 2012 6:45 am

Timo,

The impending next release of toolkit (PHP toolkit 1.4.0) has a way to run a pase command through the toolkit--the method paseCommand(). Might that help?
The beta release that you can try is here: http://174.79.32.155/wiki/uploads/XMLSE ... -beta1.zip

Example usage:
Code: Select all
// Assume $conn is the toolkit connection variable

// directory command is good example
$cmd = "ls /www/zendsvr";

echo "Running command in PASE: $cmd<BR><BR>";

$rows = $conn->paseCommand($cmd); // in PHP toolkit version 1.4.0+

if(!$rows ) {
   // error
   echo $conn->getLastError();
} else {
   // output results
   echo "Output: <BR><pre>" . var_export($rows, true) . "</pre>";
}


I would be very interested to know if this works for you, for your 'zip' needs.

--Alan
aseiden
 
Posts: 827
Joined: Thu Apr 09, 2009 5:45 pm

Re: Problem using system()

Postby timo_karvinen on Fri Dec 07, 2012 12:58 pm

This wasn't my problem actually. I was just somewhat interested in the original posters problem and tried to look a bit into it.
But I'm sure original poster will appreciate your help...

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Problem using system()

Postby aseiden on Fri Dec 14, 2012 5:46 am

Thanks, Timo. I know Ray and will contact him offline.

Alan
aseiden
 
Posts: 827
Joined: Thu Apr 09, 2009 5:45 pm


Return to Zend Server for IBM i

Who is online

Users browsing this forum: No registered users and 2 guests