On OpenBSD's httpd, I can't run PHP scripts directly within PHP files. Although I am able to execute those scripts using PHP's interactive shell, the script output is not shown on a webpage. Is there something I'm missing? I have analogous pages where I utilize javascript to run PHP scripts, however on one page I have to run either PHP or lua/luajit directly from PHP because of the big amount of JSON data and interactive element.
My httpd.conf :
Code:
chroot "/"
ext_ip="10.0.2.1"
server "tangent.localdomain" {
listen on $ext_ip port 80
listen on $ext_ip tls port 443
tls {
certificate "/etc/ssl/tangent.localdomain.crt"
key "/etc/ssl/private/tangent.localdomain.key"
}
directory index "index.php"
location "*.php" {
fastcgi socket "/var/www/run/php-fpm.sock"
}
location "*.html" {
fastcgi socket "/var/www/run/php-fpm.sock"
root "/var/www/htdocs/tn"
}
location "/cgi-bin/*" {
fastcgi socket "/var/www/run/slowcgi.sock"
}
log syslog
root "/var/www/htdocs/tn/"
}
types {
text/css css
text/html html htm
text/plain txt
image/gif gif
image/jpeg jpeg jpg
image/png png
image/svg+xml svg svgz
application/javascript js
application/xml xml
application/xhtml+xml xhtml
}
My php code inside php webpage :
Code:
<div class="mb-2 w-full">
<span class="text-xs text-gray-500 dark:text-gray-400 md:text-base block">
<?php include(\'/var/www/htdocs/tn/assets/scripts/date.php\'); ?>
</span>
<div class="text-gray-900 dark:text-white text-xs md:text-sm w-full p-2 bg-gray-100 dark:bg-gray-800 rounded-lg overflow-auto max-h-48 log-container">
<p class="whitespace-pre-wrap break-words" id="log-content">
<?php include(\'/var/www/htdocs/tn/assets/scripts/log.php\'); ?>
</p>
</div>
</div>
Webpage syntax check :
Code:
[Tue Nov 05 03:17:45 root tangent ~]
# php -l /var/www/htdocs/tn/logtest.php
No syntax errors detected in /var/www/htdocs/tn/logtest.php
Script execution in interactive php shell :
Code:
[Tue Nov 05 03:21:01 root tangent /var/www/htdocs/tn]
# php -a
Interactive shell
php > include 'assets/scripts/date.php';
11-05-2024 03:21:26
php >
The image of webpage that doesn't show the date