How to Enable allow_url_include in PHP
Introduction
The PHP directive allow_url_include allows PHP scripts to include remote files or URLs directly. Some applications, news feeds, or external integrations may require this setting to function properly.
Prerequisites
Before proceeding, ensure:
- Access to the server or hosting account
- Permission to modify
php.inior.htaccessfiles - PHP installed on the server
What is allow_url_include?
The following PHP directive enables remote URL inclusion:
allow_url_include
When disabled, PHP applications trying to include external URLs may generate errors or fail to load content properly.
Implementation
Method 1: Enable via php.ini
Open the PHP configuration file:
php.ini
Add or modify the following line:
allow_url_include = On
Save the file and restart the web server service.
Method 2: Enable via .htaccess
You can also enable the setting using the .htaccess file.
Add the following line:
php_flag allow_url_include On
Save the file.
Note
Enabling allow_url_include can introduce security risks because it allows remote file inclusion through PHP scripts. It is recommended to enable this option only if absolutely necessary and only for trusted applications.
Conclusion
By enabling the allow_url_include directive in PHP, websites can access and include remote URLs successfully for feeds, integrations, and external content loading.
