<FilesMatch> SetHandler application/x-httpd-php </FilesMatch> AddHandler application/x-httpd-php .php
#content of secret.info <?php phpinfo() ?>
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you want all .info files to be parsed as PHP, add this to your .htaccess file:
AddHandler application/x-httpd-php .php .info
To enable the execution of PHP code within a file with an unconventional extension (like .info) on an Apache server, you generally need to tell Apache to process such files as PHP. This is commonly achieved by modifying your Apache configuration to use the AddHandler or SetHandler directive to treat the custom file extension as PHP.
To enable the execution of PHP code within a file with an unconventional extension (like .info) on an Apache server, you generally need to tell Apache to process such files as PHP. This is commonly achieved by modifying your Apache configuration to use the AddHandler or SetHandler directive to treat the custom file extension as PHP.
It seems like you’ve encountered issues with using these directives. Here’s how you can troubleshoot and correctly set up Apache to process files with the .info extension as PHP:
First, ensure that the PHP module is correctly loaded in your Apache configuration. You can check this by looking for a line like LoadModule php7_module modules/libphp7.so in your Apache configuration files (the exact path and module name might vary depending on your PHP version).
.htaccess or Apache ConfigurationYou can use either the .htaccess file in the directory where your secret.info file resides, or modify the global or virtual host configuration files directly (e.g., httpd.conf or 000-default.conf).
Here’s how to do it:
.htaccessCreate or edit the .htaccess file in the same directory as your secret.info file.
Add the following configuration:
<FilesMatch "\.info$">
SetHandler application/x-httpd-php
</FilesMatch>
.info as PHP files.
- Make sure that you are allowed to use .htaccess in this directory. The AllowOverride All directive must be set in the main configuration file for Apache to read .htaccess files.Open your Apache configuration file (httpd.conf, apache2.conf, or a virtual host configuration file).
Add the FilesMatch directive inside the appropriate <Directory> block or at a global level if you want this behavior server-wide:
<FilesMatch "\.info$">
SetHandler application/x-httpd-php
</FilesMatch>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.