I fear from the phrasing of your question that you might be unaware of the very substantial security implications. Don't do this lightly on an Internet facing server.
There are a few ways of doing this. The "Apache level" way is to set up "cgi" functionality in Apache. One way to do this us to add a stanza like below to your Apache config:
AddHandler cgi-script .py
Require all granted
The above will allow you to run files ending in .pl scripts which exist in
A simpler way would be to do some kind of shell call from PHP if that is configured (a command like
shell_exec or similar would do it.)