I have a Python file, which is an automation script from GitHub. I want that script to be executed by a PHP page.
For example, I have an index.php
page, and it has a button saying Start script
. Upon clicking the button, a Python script, instabot.py
, should be executed. Is this possible in cPanel? My web host is Hostgator.
Using information from another StackOverflow post, you might wanna use exec()
to run a Python script from PHP. Like:
exec('python /path/to/file/instabot.py');
According to Hostgator's documentation, Python scripts should have permissions set at 755
.
Uploading your Python scripts will be the same as uploading any file to a web host, through the use of FTP or cPanel itself.