Custom PHP page works in draft but not when published


I have a custom PHP page that I have included as a page template in the current theme. It uses another PHP file to generate an image. The image is generated based on some input. When I create a new page based on this template and click preview, the image is generated as expected. However, after I publish the page and visit the URL, the image is not generated, just displays image placeholder thumbnail.

[Edit] Code snippet.

$swephsrc = $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/food-express/page-templates";
$sweph = $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/food-express/page-templates";
 exec ("swetest -edir$sweph -b$utdatenow -ut$utnow -p0123456789D -eswe -fPls -g, -head", $out);

echo "<img border='0' src = 'image.php?in_test=0&rx=$retrograde&p0=$longitude[0]&p1=$longitude[1]&p2=$longitude[2]&p3=$longitude[3]&p4=$longitude[4]&p5=$longitude[5]&p6=$longitude[6]&p7=$longitude[7]&p8=$longitude[8]&p9=$longitude[9]&p10=$longitude[10]' width='640' height='640'>";
, PhPa 4 years 2020-03-07T11:56:44-05:00 0 Answers 91 views 0

Leave an answer