nanoninja / docker-nginx-php-mysql

Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
1.76k stars 867 forks source link

PHP Shell_Exec cannot work in browser #56

Closed JmyW closed 3 years ago

JmyW commented 3 years ago

I'm using nanoninjia for a while. Recently I do a comment "shell_exec" in my php file, but it's failed. to reproduce it, quite easy. Make a test.php file as following content: <?php echo shell_exec('/usr/bin/docker 2>&1'); exit(); ?> Then, use browser with url "http://35.185.xxx.xxx/test.php". I got "sh: 1: /usr/bin/docker: not found" on browser. I did have $PATH include /usr/bin for sure.

if I change "echo shell_exec('/usr/bin/docker 2>&1');" to "echo shell_exec('ls 2>&1');". It works and list the files of directory.

I studied a lot of discussion on web but cannot find an answer. Most of people mentions need a absolute path. I did as above "/usr/bin/docker" but still unsuccessful.

I start suspect whether it's something wrong in nanoninjia ?? or sorry because of my poor knowledge on docker and nginx?

Is anyone seeing same problem?

JmyW commented 3 years ago

Close issue, since it's not Nanoninjia's issue. Sorry for confusion.