Question

Call PHP from IBM i Server with Zendserver I sent a few Parms to php script. On one of our machines the parms were split on blanks ? But why ? They are in Doublequotes ??

CALL       PGM(QP2SHELL) +                                
           PARM('/USR/LOCAL/ZENDSVR/BIN/PHP-CLI' +        
           '/www/zendsvr/htdocs/test/t1.php' +    
           'Hallo Test' + 'P2' + 'P3')

In PHP the args array contains

[0] => /www/zendsvr/htdocs/idsmail/t1.php5
[1] => Hallo
[2] => Test
[3] => P2                            
[4] => P3 

On other machines the same Program works fine ??

Any ideas ?

Bye jogi

Was it helpful?

Solution

If your example looks exactly like your CL code, then you've got too many + signs. In source code, CL commands normally terminate at the end of a line. If your command continues onto another line you indicate this with a + symbol. In this context it is not a meant as a concatenation operator (which would be ||). Spaces suffice to separate the parameters.

You don't need the + signs on the 4th line, which would be seen as arithmetic operators. This should solve your problem:

CALL       PGM(QP2SHELL) +                                
           PARM('/USR/LOCAL/ZENDSVR/BIN/PHP-CLI' +        
           '/www/zendsvr/htdocs/test/t1.php' +    
           'Hallo Test'  'P2'  'P3')

The keywords PGM and PARM are not required, so personally, I would write it like this:

CALL QP2SHELL  ('/USR/LOCAL/ZENDSVR/BIN/PHP-CLI' +        
                '/www/zendsvr/htdocs/test/t1.php' +    
                'Hallo Test' +
                'P2' +
                'P3' +
               )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top