php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77645 Error in the exec function
Submitted: 2019-02-21 09:40 UTC Modified: -
From: ailiangkuai at qq dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 7.1.26 OS: CentOS release 6.8 (Final)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-02-21 09:40 UTC] ailiangkuai at qq dot com
Description:
------------
---
From manual page: https://php.net/function.system
---
i want execute linux shell via php.if the shell works fine,the $output will be filled with every line of output from the shell script.but if shell script has error,$output is filled whith nothing. i have used the func of python which is commands.getoutput,Get the result regardless of whether the script has an error.

Test script:
---------------
<?php
$lastOutput = exec("gunzip < /backup-files/test.sql.gz | mysql -u*** -p'***' --host=localhost --database=test",$output,$return_var);


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:25 2019 UTC