allowurlfopen is globally set ON but in some folder is reported as OFF, no .htacess is…
- User
allow_url_fopen is globally set ON but in some folder is reported as OFF, no .htacess is present, why is that?
- Assistant
allow_url_fopen is globally set ON but in some folder is reported as OFF, no .htacess is present, why is that?
The issue you're encountering—where allow_url_fopen is globally set to ON but reported as OFF in certain folders—can be perplexing, especially when no .htaccess file is present to override the setting. This behavior is likely due to per-directory PHP configuration overrides that aren't immediately visible.
Here's what's probably happening:
Per-directory php.ini or .user.ini Files:
php.ini Files: While the main php.ini file is typically located in a central directory, PHP allows per-directory php.ini files. If there's a php.ini file in the folder (or any parent folder up the directory tree), it can override the global settings. These files might not be immediately noticeable because they can be placed deep within the directory structure..user.ini Files: Starting from PHP 5.3, PHP introduced the concept of per-directory .user.ini files. Similar to .htaccess, these files allow you to set PHP configurations on a per-directory basis. If there's a .user.ini file in the folder or any parent folder, it could be setting allow_url_fopen to OFF.Web Server Configuration Overrides:
php_admin_value: In Apache's configuration (httpd.conf or virtual host files), administrators can use the php_admin_value or php_admin_flag directives to set PHP configuration options per directory or virtual host. These settings cannot be overridden by user-level configurations or scripts.PHP-FPM Pool Configurations:
allow_url_fopen set to OFF.Parent Directories Affecting Subdirectories:
What You Can Do:
Search for Per-directory Configuration Files:
php.ini or .user.ini files in the current directory and all parent directories.find /path/to/your/webroot -name 'php.ini' or find /path/to/your/webroot -name '.user.ini' to locate these files.Check Web Server Configurations:
allow_url_fopen for specific directories.php_admin_value or php_admin_flag directives.Review PHP-FPM Pool Settings:
/etc/php-fpm.d/ or similar directories) for any settings overriding allow_url_fopen.Verify with phpinfo():
phpinfo(); in the affected directory. This will display all the PHP configuration values, including their local and master values, which can help identify where the change is coming from.In Summary:
Even without a .htaccess file, PHP settings can be overridden by per-directory php.ini or .user.ini files, or through web server configurations. By carefully examining these potential override points, you can identify why allow_url_fopen is being reported as OFF in certain directories despite being globally enabled.
Answer:
Because a per-directory PHP configuration—like a php.ini or .user.ini file in that folder or a parent folder, or a web server setting overriding it—is turning off allow_url_fopen there; even without a .htaccess file, such local settings can disable it in specific directories despite the global setting being ON.
Not yet included in a published release.