• Hello! New to WordPress: Can I launch a Python program under Linux from a WordPress page? I tried a plugin (php code snippet) with php script to no avail. Help appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Where is the program located? Does that location have Python installed?

    Thread Starter jf99

    (@jf99)

    Hi Joy, both Python and WordPress are installed on one system: Raspberry Pi 4 running Debian/Apache2/SQL. I would like to trigger a Python application from a WordPress page. Is it possible? (I tried PHP scripts via plugins but that didn’t work). Thanks, John

    Is your server set up to do Python as CGI? You can link to your Python script.
    But if you want to run Python and use its output in the page being generated from PHP, you’ll need to capture the output (unless the Python returns its output in a parameter or something).

    Thread Starter jf99

    (@jf99)

    To be sure, I updated apache2.conf (no httpd.comf on Debian) and .htaccess for CGI. Still not working. My script is very simple as I just want to launch (and forget) an independent python program from a wordpress page without passing parameters/output – all on the same server: <?php exec(‘python3 /home/pi/webapp/app4.py’); ?> I use an html block on the wordpress page to write the script. Any idea why it’s not working?

    Well, is it actually in the content saved in the database? Is it saved as code or entities? (It should be stripped out or encoded.)
    Do you have a plugin that allows you to execute PHP within content?
    Is there an environment variable with the path to python3?
    Is the script marked executable?

    zackynaeem

    (@zackynaeem)

    Python is a programming language. It is a dynamically typed language. It is used in a number of places. If you want to learn more about python programming language click on the following link:
    python programming

    • This reply was modified 5 years ago by zackynaeem.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Python/Linux program launch from WP’ is closed to new replies.