How to Fix File Access Is Disabled in the Server Configuration
I am checking it my link verifier script is working when I have encountered this error. This is my function that checks if a url is existi...
https://www.czetsuyatech.com/2021/07/php-fopen-file-access-is-disabled.html
I am checking it my link verifier script is working when I have encountered this error.
This is my function that checks if a url is existing.
But, it always return the above error. I tested locally and found out that it's working.
Problem: Most web hosting company have strict default value for php setting. Example: allow_url_fopen is default to off. Which is why I have the mentioned error.
Solution:
Create a php.ini in your root directory and just add this line:
[ini]
allow_url_fopen = 1
[/ini]
This will enable file-access.
This is my function that checks if a url is existing.
function ipiel_ping_link($obj) {
$flag = 0;
try {
$handle = fopen($obj, "r");
if (!$handle) {
$flag = 0;
} else {
$flag = 1;
fclose($handle);
}
} catch(Exception $e) {
$flag = 0;
}
return $flag;
}
But, it always return the above error. I tested locally and found out that it's working.
Problem: Most web hosting company have strict default value for php setting. Example: allow_url_fopen is default to off. Which is why I have the mentioned error.
Solution:
Create a php.ini in your root directory and just add this line:
[ini]
allow_url_fopen = 1
[/ini]
This will enable file-access.
Post a Comment