I'm experiencing an odd issue. I have a Python script that I'm calling from a PHP script. This is all running on an Apache server on Ubuntu 18.04. Part of the Python script uses the Google Drive API. EDIT: See the bottom After a lot of testing and replication,I've concluded that simply having the following Google Drive Python libraries and dependencies imported:

```
from __future__ import print_function
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
from googleapiclient.http import MediaIoBaseDownload

```

Messes up the script when it is called from the web. By that I mean the Python script does not seem to execute, and any shell output that I should be getting through print statements do not make their way back to the PHP script. When calling the script locally (python myscript.py), it works just fine.

The weird part is that when I remove these import statements from the Python script, it executes just fine from both PHP, and from directly launching the script from a browser. In both of those cases I am also able to get the shell output back to the PHP script. I have given the proper permissions for the Python script, and I have configured Apache to be able run CGI scripts. Here is what my Python script looks like:

```
#!/usr/bin/env python3
import cgitb

from __future__ import print_function
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
from googleapiclient.http import MediaIoBaseDownload

cgitb.enable()
print("Hello World")

```

And here is what my PHP script looks like:

```
<?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);

    $output = shell_exec("python path_to_my_script/myscript.py");
    echo $output;
?>

```

EDIT:
I ran a couple of tests using another 3rd party Python library that I installed with pip, and this actually seems to be an issue with importing any 3rd party library when executing the script via PHP.