Re: Problem with "shell_exec"

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

 



Hello,

i am sorry for it took ridiculously long for me to respond, but i have been
struggling with the issue ever since. I still don't really know what the
problem was, but i have managed to solve it through a shortcut.

I have tried everything recommended from you. In php.ini the shell_exec
wasn't listed under "disabled functions". I have tried adding a new user
with the (i presume) right permissions and starting the server through it. I
have tried busybox httpd and lighttpd with the new user, as well as with the
old "nobody". I have installed bash (instead of busyboxs' shell) and even
tried installing it in the root server folder (/var/www)- still the problem
persisted.

What i have done today is compiling php through buildroot and than copy over
the binary php-cgi to the embedded system. It worked like a charm- out of
the box, without the adjustments i made previously. So it seems- to me- that
this was a cross- compiling issue on my side. I don't know what have i done
wrong with the compilation, but right now i don't have much time to look it
up- i must proceed with the project. If i find out what was causing the
problem, i will be sure to post a solution here.

So- thank you very much. Your help is indeed appreciated.

Yours,

Boyan

1.

On Sun, Oct 31, 2010 at 11:24 PM, <admin@xxxxxxxxxxxxxxxxxxx> wrote:

> 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
> >
> >
>
>

[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