Can I read a file when allow_url_fopen is disabled?

software development


I’m using PHP.

Is it possible to open a local file on my domain using file_get_contents while keeping allow_url_fopen disabled?

I would use $_SERVER[‘DOCUMENT_ROOT’] for the pathway.


Yes; allow_url_fopen only affects whether you can use PHP file functions on URLs, e.g:


good to hear… thanks, andrew.