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...@googlemail.com] 
Sent: Sunday, October 31, 2010 12:26 PM
To: ad...@buskirkgraphics.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] 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, <ad...@buskirkgraphics.com> 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...@googlemail.com]
> Sent: Sunday, October 31, 2010 11:16 AM
> To: php-general@lists.php.net
> Subject: [PHP] 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

Reply via email to