简体   繁体   中英

Running python in php for image processing

hi everyone I want to run a python script through php in which i've to do image processing and update a database and then use that database in same php program. Is it feasible ? If yes then how ? I am a beginner so apology if the question isn't up to the mark. Please help me making my first project :)

you can use exec command to run python script from php

exec(python script_name parameter)

To know more about exec go to this link

http://php.net/manual/en/function.exec.php

I've used php to call python machine learning script.Try this

Example for Ubuntu

$values=shell_exec('/usr/bin/python two.py '.$ing.'');

Example for Windows

$values=shell_exec('C:\Python27\python two.py '.$ing.'');

$ing is the variable passed to the script. Remember to give the absolute path of python. It was pretty feasible for me. But performance mostly depends on your python script as the php just executes the python code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM