Run the PHP file through the browser to call the Python script code does not execute?

under Windows, PHP calls python, to run PHP files through the browser, but calls Python"s video playback function. What"s going on?

video.php file

$shell = shell_exec ("test.py");

test.py file

from os import startfile

startfile ("a.avi");

run php video.php under the CMD command to call the local default player to open the video

but I don"t respond when I use the browser localhost/test/video.php. What"s going on

Sep.16,2021

permission problem? The role of executing the script when browsing the web is www-data or the


that you configure yourself.

should be the execution directory (the reason for the working directory) when), PHP is called, it becomes the current PHP directory. So change the working directory, or set the path of the file opened by py to an absolute path.

< H1 > change the work path < / H1 >

import os
os.chdir

< H1 > View the path to the py execution file < / H1 >

import sys
print (sys.argv [0])

< H1 > View current work path < / H1 >

import os
print (os.getcwd ())

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1cfa79f-3a1d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1cfa79f-3a1d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?