RE: Problem with "shell_exec"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After going over this a thousand times in my head and on sever.
Here are a few reasons why a shell_exec will not function.

First I tested the PHP CLI
Can I see my version of php.
$output = shell_exec('php -v');
Echo $output;
If I am not getting the information about the php version. Is shell_exec for
php and http on?

In your php.ini file there will be a section called disable_functions.
If you are sure that shell_exec is not in the list.


If neither of these are an issue for you, It has to be a permissions issue.


I do not claim to be an expert in the shell_exec area of php, I cannot
duplicate your error.

Richard L. Buskirk


-----Original Message-----
From: Boyan Penev [mailto:boyan.mp@xxxxxxxxxxxxxx] 
Sent: Sunday, October 31, 2010 12:26 PM
To: admin@xxxxxxxxxxxxxxxxxxx
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Problem with "shell_exec"

Hello Richard,

thank you for the prompt reply. I just tried to follow your suggestion, but
i couldn't solve my problem:

1. I  have started the server with user "nobody". All the binaries i was
trying to execute(e.g. /bin/ls) were "chown"-ed to the user "nobody"
Problem presisted. Than i "chown" -ed /var/www to the user "nobody". Than
the php and php-cgi interpreters as well- same thing.
I tried the same with users "adm" and even "root"

2. I than gave the executables all the permissions possible("777"- i know it
is dangerous, but i am just testing)- still nothing.
 I copied the binaries from /bin to /var/www and tried to execute them
with all kinds of permissions and "chown"'s- didn't work

3. Than i moved to the command line interpreter: i tried to execute it in
/var/www and in the home folder. The permissions were also adjusted. I
executed it with root privileges- i always get "Segmentation fault". One
more thing- if i omit the arguments in shell_exec( "$output = shell_exec();)
i get "Missing parameters" but no "Segmentation fault"

Boyan

On Sun, Oct 31, 2010 at 4:34 PM, <admin@xxxxxxxxxxxxxxxxxxx> wrote:

> It seems most probably a permission problem.  If I were you I would
> check the permissions on the bin directory and the files in it.  PHP
> will probably run under the uid of the webserver, which, on most
> systems is either "apache" or "nobody" depending on the configuration.
>
> Richard L. Buskirk
>
>
> -----Original Message-----
> From: Boyan Penev [mailto:boyan.mp@xxxxxxxxxxxxxx]
> Sent: Sunday, October 31, 2010 11:16 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Problem with "shell_exec"
>
> Hello,
>
> i have installed php 5.2.14 on an embedded system. I have run a couple of
> test scripts and everything works fine,
>  but i can't get "shell_exec" to work. When i invoke "shell_exec", the
> script doesn't get interpreted, instead
> i get prompted to download the whole .php file. I have tried both /bin/php
> and /bin/php-cgi- same problem.
> When i try to execute it per command line instead of web server, with both
> php and php-cgi i get "Segmentation fault"
> and nothing happens. I use busybox http as a web server, if it's relevant.
> Does anybody have an idea what the problem
> might be? Any help would be appreciated.
>
> Best regards,
>
> Boyan
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux