PHP issues with new server

TechTronic

New member
Joined
Feb 16, 2024
Messages
3
I just setup a new clean Ubuntu 22.04 VPS with installed DirectAdmin, configured the primary/only domain and published a website. HTML pages of the site work fine, but php pages are downloaded by the browser instead of loaded and executed.

DirectAdmin is configured with nginx_apache. I first tried several versions of php-fpm, 8.1 and 8.2 would partially load the php pages of the site, and 8.3 seemed to work fine, the pages fully loaded as expected. However, beyond the main php page, the site utilizes link rewrites to generate "pretty" URLs to sub-pages which are php. I figured out that php-fpm doesn't support .htaccess. I reconfigured PHP to use fastcgi, tried both 8.3 and 7.4 (current server hosting the site is 7.4), but both of those options result in the php pages downloading as files instead of loading/executing. I've enabled htscanner in CustomBuild, ran ./build for php and php_htscanner2, ran rewrite_confs from CLI and CustomBuild, restarted apache and nginx, tried toggling php_ini (current/default = "no") and secure_php (current/default = "yes") options in CustomBuild and so far I'm getting nowhere.

I will also need to host WordPress sites on this server, but one step at a time for now.

Any help would be greatly appreciated.
 
I don't use nGinx so no clue on how it works with that.
I do use normale apache with php-fpm and it always says since PHP 8.x that php_htscanner is not available for those php versions.

However the mod_htscanner does work, it can be enabled like this:
Code:
cd /usr/local/directadmin/custombuild
./build mod_htscanner2
./build php
./build rewrite_confs

If you already done this, then I don't know. But as said, this is for normal Apache, I don't know how/if this works with nGinx.

tried toggling php_ini (current/default = "no")
This only configures if a php.ini must be supplied when building php. I normally have this to yes on first install and then set it to no, so the php.ini does not get overwritten anymore.

The secure_php option can be kept to yes if you want, it takes care that the disable_functions line in the php.ini is filled so php is more secure.
 
@Richard G - Thanks for the reply. I ended up converting the .htaccess rules to NGINX rules with the help of ChatGPT, added them to the nginx.conf in Custom HTTPD Configurations, and everything works as expected using version 8.3 of php-fpm.
 
Back
Top