RayTaylorII Posted November 15, 2012 Share Posted November 15, 2012 I am using the PHP system() function to run an unzip utility in linux (on an IBM i). system() is returning a return value of 50 and does not perform the unzip. Is there a list explaining what the various system() return codes? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/ Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2012 Share Posted November 15, 2012 From the php manual entry for system: Returns the last line of the command output on success, and FALSE on failure. Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392637 Share on other sites More sharing options...
RayTaylorII Posted November 15, 2012 Author Share Posted November 15, 2012 (edited) From the php manual entry for system: Returns the last line of the command output on success, and FALSE on failure. I did see that in the PHP manual, but the command does not complete, so I would expect a false, but the return code is 50. 50 isn't part of the command output? This is the actual line of code being executed: system("unzip -qq -P password /FTPRTLORD/ORDERS/ROrders_01012012_000501.ZIP -d /FTPRTLORD/ORDERS/",$retValue); $retValue comes back 50. Edited November 15, 2012 by RayTaylorII Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392642 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2012 Share Posted November 15, 2012 AFAIK, system() returns FALSE if system() fails to execute, not the command within it. The value is what is being returned from the command. Have you run the command from the CLI? Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392656 Share on other sites More sharing options...
RayTaylorII Posted November 15, 2012 Author Share Posted November 15, 2012 AFAIK, system() returns FALSE if system() fails to execute, not the command within it. The value is what is being returned from the command. Have you run the command from the CLI? I run the command in the linux command line interace on the IBM i and it runs fine. Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392661 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2012 Share Posted November 15, 2012 Does the PHP/web user have permissions to run the command? Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392662 Share on other sites More sharing options...
RayTaylorII Posted November 15, 2012 Author Share Posted November 15, 2012 Does the PHP/web user have permissions to run the command? Yes Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392667 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2012 Share Posted November 15, 2012 Then I'm out of ideas . . . Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392669 Share on other sites More sharing options...
RayTaylorII Posted November 15, 2012 Author Share Posted November 15, 2012 Does the PHP/web user have permissions to run the command? Actually, you are dead on!!!! I assumed (and you know what that does) that the user name I used to connect to the database was the same user who was used to run system commands...not so. Once I found the correct user being used, I updated permissions for that user and it works.... Thanks so much!!!! Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392680 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2012 Share Posted November 15, 2012 Excellent. I've marked the thread solved for you. Quote Link to comment https://forums.phpfreaks.com/topic/270728-system-return-values/#findComment-1392689 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.