Re: [PHP] Problem with shell_exec
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, ad...@buskirkgraphics.com 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...@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
RE: [PHP] Problem with shell_exec
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
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
RE: [PHP] Problem with shell_exec
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