I know, I know, sounds very bizarre.
I have a flask application on heroku which is running plenty fine. I must have one page which runs a PHP script, which will have little to nothing to do with my flask back end. It connects to an external database and renders a few rows on the page. Eg,
<?php
mysql_connect($hostname, $username, $password) or DIE ("connection failed");
mysql_select_db($dbname);
$id = REQUEST["id"];
$query = "select * from table1"
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
?>
// leaving out for brevity
<div class="container">
<?php
echo "$row['name']<br/>"
?>
</div>
However, if possible, I would rather not make a FULL new application to run a one to three PHP scripts. All that is important is that the script in the PHP page runs. The db is an external mysql database
Is it possible to run this along side a flask application? If so, how?
First of all you need to make sure that your Heroku app runs with PHP installed; probably it does not.
You can probably get this using a custom build pack that ships with both PHP and Python.
Once you have PHP you can run the scripts invoking PHP's interpreter from Python.
php_output = subprocess.check_output(["php", "script.php"])