Multiple choice technology web technology

To work with remote files in PHP you need to enable?

  1. allow_url_fopen

  2. allow_remote_files

  3. both of above

  4. none of above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The allow_url_fopen PHP ini directive enables URL-aware fopen wrappers that allow accessing remote files via HTTP/FTP. Option B (allow_remote_files) is not a valid PHP directive. This setting is essential for functions like fopen(), file_get_contents(), and include() to work with remote URLs.

AI explanation

To work with remote files in PHP, you need to enable the allow_url_fopen directive.

Option A) allow_url_fopen - This option is correct because it allows PHP to open remote files using functions like file_get_contents() and fopen() with URLs as the file path.

Option B) allow_remote_files - This option is incorrect because there is no such directive in PHP.

Option C) Both of the above - This option is incorrect because only the allow_url_fopen directive needs to be enabled to work with remote files in PHP.

Option D) None of the above - This option is incorrect because the allow_url_fopen directive is required to work with remote files in PHP.

The correct answer is A) allow_url_fopen. This option is correct because it allows PHP to open remote files.