Disable default php extensions and enable another

Heber Lourenção

New member
Joined
Aug 16, 2025
Messages
2
Location
Brazil
It's possible to disable the php default extensions on a server?(this server uses DirectAdmin)

In my localhost (using Mint + LAMPP), i've configurate the file /opt/lampp/etc/extra/httpd-xampp.conf in this line:

# since LAMPP 1.0RC1
# AddType application/x-httpd-php .php .php3 .php4
AddType application/x-httpd-php .xyz

Note I'm trying to disable default extensions and use a .xyz pointed to PHP file executable.

It's works fine. But not work in my online server, where I'm using AlmaLinux + Apache + DirectAdmin.

How to do this?

If anyone is curious about the reasons for this, write here or send DM. It's related to security issues.
 
Hello,

If you use Apache + PHP-FPM, you will need to modify the following templates (a list of file extensions is listed there):

- /usr/local/directadmin/data/templates/php-fpm.conf
- /usr/local/directadmin/data/templates/virtual_host2.conf
- /usr/local/directadmin/data/templates/virtual_host2_secure.conf
- /usr/local/directadmin/data/templates/virtual_host2_secure_sub.conf
- /usr/local/directadmin/data/templates/virtual_host2_sub.conf

But first copy them to /usr/local/directadmin/data/templates/custom/ folder (create it if it's missing). DO NOT EDIT the files in the original place, otherwise you will loose your customization.

Related:

- https://docs.directadmin.com/webservices/php/php-fpm.html
- https://docs.directadmin.com/webservices/apache/customizing.html
 
Hello,

If you use Apache + PHP-FPM, you will need to modify the following templates (a list of file extensions is listed there):

- /usr/local/directadmin/data/templates/php-fpm.conf
- /usr/local/directadmin/data/templates/virtual_host2.conf
- /usr/local/directadmin/data/templates/virtual_host2_secure.conf
- /usr/local/directadmin/data/templates/virtual_host2_secure_sub.conf
- /usr/local/directadmin/data/templates/virtual_host2_sub.conf

But first copy them to /usr/local/directadmin/data/templates/custom/ folder (create it if it's missing). DO NOT EDIT the files in the original place, otherwise you will loose your customization.

Related:

- https://docs.directadmin.com/webservices/php/php-fpm.html
- https://docs.directadmin.com/webservices/apache/customizing.html

Hello Alex! Many thanks!

Do you think this change will cause any issues with the DirectAdmin panel (or other features)?

Do you think this change will cause any issues with the DirectAdmin panel or other features running?

I dev an app are deployed in one of ~30 other host accounts in my server.

I think if this changes affect all accounts, right?

The ideal scenario: change default php extension for only one accout, where I dev my application. In the future, my intention is get run the app on dedicated server.

I dev in PHP. I'm trying to run only "index.xyz" as a PHP executable. The other files are called by "require()" and can have any extension.
 
Back
Top