0

I'm trying to execute a Python script via PHP. I can run Python 2.7 but when I call "which python" in the respective directory I only receive the absolute path for Python 2.7.

When I call the PHP script now, the output is blank - nothing happens.

I've been looking around online for the past few days and the main idea that I took away was that the script wasn't executable within a PHP/Apache context.

But trying to change the group id of the file has been a bit more complicated.

When I call:

chgrp _www /Users/[username]/googleSpeechApi/args_test.py

I receive:

chgrp: you are not a member of group _www

So I opened vim /etc/apache2/httpd.conf and found:

User _www
Group _www

Doesn't this tell me the user/group that an Apache user will be _www? Is this an issue of me calling chgrp in a non-sudo mode?

At the end of the day - I just want to be able to execute a python3 script (I need to use NLTK and a series of Google libraries that are only executable with Python 3) from a PHP file. If there's another way to achieving this then I'm all ears,

Cheers :)

Hews
  • 569
  • 6
  • 19
  • 2
    Possible duplicate of [Running a Python script from PHP](https://stackoverflow.com/questions/19735250/running-a-python-script-from-php) – Sajith Herath Jun 01 '18 at 05:10
  • I already checked that and the answer uses Ubuntu Server 10.04. There's different conventions for MacOS that make a lot of solutions for Ubuntu/Linux-distributed OSs' generally separate. – Hews Jun 01 '18 at 05:12

0 Answers0