Bug #74656 [Opn]: php -m command gives unreadable output when run via exec()

From: Date: Fri, 26 May 2017 12:17:04 +0000
Subject: Bug #74656 [Opn]: php -m command gives unreadable output when run via exec()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209269@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74656&edit=1

 ID:                 74656
 User updated by:    frederik at how2 dot be
 Reported by:        frederik at how2 dot be
 Summary:            php -m command gives unreadable output when run via
                     exec()
 Status:             Open
 Type:               Bug
 Package:            PHP options/info functions
 Operating System:   CentOS 7.3
 PHP Version:        7.0.19
 Block user comment: N
 Private report:     N

 New Comment:

Further investigation points to the php.ini option: zlib.output_compression = On
When we set it to Off, the output is OK.


Previous Comments:
------------------------------------------------------------------------
[2017-05-26 09:52:02] frederik at how2 dot be

Description:
------------
When I run the command "php -m" using:
- the exec function
- the shell_exec function
- a perl equivalent of the above

The output is unreadable like this:
OUT:Array ( [1] =>
�EQ�n�0��W���CED�RUȱ7���.����á�G^{f|�޻�]rWO������)ؤB���Z���%�����y���8�5J�f�#�ҬC�dd�o�`28�ǯ���/$��RƁC�����ĪZ�iŞI���띯5-Y�d\Q(
�t�ȏ�ݹ�a]M@�Z�m�{��\M=8�Q���5������V��
) 
RET:0

Other command such as "php --version" and executing the same on PHP 5.6.30 work fine.
The get_loaded_extensions function also works fine.
also tried running it with --no-php-ini but got the same result.

I can reproduce this on 2 servers with PHP 7.0.19.

Test script:
---------------
exec($bin.' --version', $extout, $extret);
echo '<br />OUT:';
print_r($extout);
echo '<br />RET:';
print_r($extret);



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74656&edit=1


Thread (3 messages)

« previous php.bugs (#209269) next »