Skip to content
Advertisement

Trying to run python script in PHP

I’m trying to run a Python script inside a perl script with the following command:

JavaScript

On the operating system’s command line, the Python script executes, but when I make a call from a PHP application, the perl work, but the python script don’t work.

Advertisement

Answer

Do you get any error message from Perl side? Likely where your PHP/Perl script runs from isn’t the same location as where script.py is at. Try by using full path to Python script. Also double check that python3 is in your $PATH.

For example: -> cat /home/me/python/script.py

JavaScript

-> cat /home/me/perl/pytest.pl

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement