This article will introduce to you the problem that php exec system shell_exec cannot be executed. The main content is to explain the method of executing php exec() system() shell_exec() without results and the result is NULLD. I hope it will be helpful to friends in need~
php exec() system() shell_exec() cannot be executed, there is no result, the result is NULLD, solution
<?php $cmd = 'php -v'; exec($cmd, $arr); echo '<pre class="brush:php;toolbar:false">' var_dump($arr);
After the browser is accessed, the printed result is: NULL
It means that the server has not turned on PHP and used exec(); [Recommended learning: PHP video Tutorial】
Solution:
<?php var_dump(get_current_user()); $cmd = 'php -v'; exec($cmd, $arr); echo '<pre class="brush:php;toolbar:false">' var_dump($arr);
Display: root
$ chmod 777 index.php
View the user and permissions of index.php:
$ ll
Result:
-rwxrwxrwx 1 root root 1595 Sep 20 10:18 index.php
$ cd /usr/local/php/etc $ vim php.ini
Remove exec, system, and exec_shell and use whichever one you use;
$ /etc/init.d/php-fpm restart
The above is the detailed content of Executing php exec system shell_exec has no results? Done in one article!. For more information, please follow other related articles on the PHP Chinese website!