The solution to the problem that php cannot execute python: first find and open the php-fpm.conf file; then modify the user and group of php-fpm.conf to root.
The operating environment of this article: Windows7 system, PHP7.1&&python3.5 version, DELL G3 computer
php cannot execute python?
To use php to execute the python command, I found that the command line can output the results normally, but the browser cannot output the results.
After adding 2>&1 after the command and printing the error message, we found that there was a permission error when importing the third-party library.
So I modified the user and group of php-fpm.conf to root and successfully solved it.
Note that php-fpm cannot be run as the root user by default, but it can be run with the -R parameter.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if php cannot execute python?. For more information, please follow other related articles on the PHP Chinese website!