[Python] How to call vertex ai script from php from a browser url on a linux or Mac server?

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to call a vertex ai generated python script to generate text from a php page and invoke it from a browser url.

    The python script does not work on a linux or Mac server(but works on windows) when invoked from php through the browser url.

    Interestingly the script works in terminal.

    I am calling the vertex ai python script from php like this:

    $Output = shell_exec("python3 vertex.py");

    print($Output);

    I am looking for a way to run the python script from the browser when called or invoked from the php script on a linux or macOS Server.

    I am thinking that the issue could be due to/linked to handling virtual environment using php when the python script is invoked from the browser using php.

    Bottom line it could be linked to the following underlying issues:


    1. How to handle google login/authentication for vertex scripts when called from the browser?


    2. It could also be linked to the handling of the virtual environment using php or python.

    Continue reading...

Compartilhe esta Página