php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38007 system() does not work under apache
Submitted: 2006-07-04 16:40 UTC Modified: 2006-07-15 01:00 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: marcus dot yu at rogers dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.1.4 OS: fedora core 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marcus dot yu at rogers dot com
New email:
PHP Version: OS:

 

 [2006-07-04 16:40 UTC] marcus dot yu at rogers dot com
Description:
------------
The function system() does not work in PHP 5.1.4 under Apache 2.2.0+ in fedora core 5. The kernel is 2.6.17-1.2139_FC5. The return value is 127. If runs as shell script, the function works. The safe mode is off. It was tested on both Apache 2.2.0 and 2.2.2.

Reproduce code:
---------------
<?
   $last_line = system ("ls -l", $return_value);
   echo " return value : $return_value ";
?>

Expected result:
----------------
list all files in the working directory just as run 'ls -l' in command line. 
and the return value is 0. 

Actual result:
--------------
nothing. the return value is 127. 

In fact, if modified the code a little bit and run it as shell script, it works. 



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-04 19:42 UTC] iliaa@php.net
Is ls binary in the path?
 [2006-07-04 20:01 UTC] marcus dot yu at rogers dot com
yes. even use /bin/ls got the same result.
 [2006-07-05 01:49 UTC] judas dot iscariote at gmail dot com
return value : 2
current CVS, apache 2.2.2 on Linux.
 [2006-07-06 20:38 UTC] tony2001@php.net
Did you enable SELinux ?
 [2006-07-06 21:45 UTC] marcus dot yu at rogers dot com
Yes. It doesn't work with SELinux enforced. Why? 
The machine is going to host a web site over SSL. Any impact if SELinux is disabled?
 [2006-07-06 21:59 UTC] tony2001@php.net
Well, then it's clearly not PHP problem.
You just need to configure SELinux appropriately to allow Apache to execute binaries or just disable SELinux.
 [2006-07-06 22:00 UTC] marcus dot yu at rogers dot com
it works with older verson of php (i.e. 4.3.11) while SELinux is enforcing.
 [2006-07-06 22:10 UTC] tony2001@php.net
It works with 4.3.11 and SELinux enabled on the same machine with the same configuration?
I can hardly believe in that.
Also, I don't really see how we can investigate it since we don't have access to your machine and we've no idea of your configuration.
 [2006-07-06 22:43 UTC] marcus dot yu at rogers dot com
Of course not on the same machine. The machine with SELinux  enforcing runs kernel 2.6.10-1.770_FC3, Apache 2.0.53, and php 4.3.11.

There is no technical difference between the two apache configurations. Or I missed where to configure SELinux to let Apache run binaries. The file /etc/selinux/config does not tell much.
 [2006-07-07 08:20 UTC] tony2001@php.net
>Of course not on the same machine.
Then please install the snapshot or 5.1.4 there and see if it works.

 [2006-07-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC