Cara menggunakan allow_url_fopen in php

Hi, 

I have a fresh 2.2.5 install and I want to install a new theme, but I can't because it seems to think that allow_url_fopen isn't allowed. 

running composer diagnose yields the below: 

-bash-4.2$ composer diagnose
Checking composer.json: WARNING
The version field is present, it is recommended to leave it out if the package is published on Packagist.
Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance
require.magento/product-community-edition : exact version constraints (2.2.5) should be avoided if the package follows semantic versioning
require.composer/composer : unbound version constraints (@alpha) should be avoided
Checking platform settings: FAIL

The allow_url_fopen setting is incorrect.
Add the following to the end of your `php.ini`:
allow_url_fopen = On

Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

Checking git settings: OK
Checking http connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: allow_url_fopen must be enabled in php.ini (http:// wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)
Checking https connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version:

[Composer\Downloader\TransportException]
The "https://getcomposer.org/versions" file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url
_fopen=0
failed to open stream: no suitable wrapper could be found)

diagnose

and yet, I KNOW it's enabled:  I created a phpinfo() page, which returns this : 

Core
PHP Version	7.1.20
Directive	Local Value	Master Value
allow_url_fopen  	On	On
allow_url_include	On	On

because I don't trust the UI (I'm running multiple PHs...) and because I've researched this problem before posting, I tried at the CLI level: 

-bash-4.2$ php --version
PHP 7.1.20 (cli) (built: Jul 23 2018 21:23:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.20, Copyright (c) 1999-2018, by Zend Technologies

-bash-4.2$ php --ini | grep php.ini Configuration File (php.ini) Path: /opt/cpanel/ea-php71/root/etc Loaded Configuration File: /opt/cpanel/ea-php71/root/etc/php.ini -bash-4.2$ grep fopen /opt/cpanel/ea-php71/root/etc/php.ini ; http://php.net/allow-url-fopen allow_url_fopen = On -bash-4.2$

I'm at a loss for words here ... 

This article describes how to enable and disable the allow_url_fopen directive in a custom php.ini file.

The information in this article only applies to certain types of hosting accounts. To determine whether or not the information below applies to your account, please see this article.

This article assumes that you have already set up a custom php.ini file on your web site. If you have not already set up a custom php.ini file, please read this article first.

Using the allow_url_fopen directive

The allow_url_fopen directive is disabled by default. You should be aware of the security implications of enabling the allow_url_fopen directive. PHP scripts that can access remote files are potentially vulnerable to arbitrary code injection.

When the allow_url_fopen directive is enabled, you can write scripts that open remote files as if they are local files. For example, you can use the file_get_contents function to retrieve the contents of a web page.

To enable this functionality, use a text editor to modify the allow_url_fopen directive in the php.ini file as follows:

allow_url_fopen = on

To disable this functionality, modify the allow_url_fopen directive in the php.ini file as follows:

allow_url_fopen = off

To verify the current value of the allow_url_fopen directive and other directives, you can use the phpinfo() function. For more information, please see this article.

More Information

  • To view a complete list of php.ini directives, please visit http://www.php.net/manual/en/ini.list.php.
  • For more information about the allow_url_fopen directive, please visit http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen.
  • For more information about the file_get_contents function, please visit http://www.php.net/file_get_contents.

How do I enable url fopen?

How to enable or disable allow_url_fopen in cPanel.

1) Log into cPanel..

2) Look for the SOFTWARE section and click on Select PHP version..

3) In the new window click on the Switch To PHP Options link..

4) Here you can locate the allow_url_fopen and tick on the box next to it to enable it or un-tick the box to disable it..

What is the use of Allow_url_fopen?

allow_url_fopen can be used to retrieve data from remote servers or websites. However, if incorrectly used, this function can compromise the security of your site.

Where can I find PHP INI in WordPress?

If you're using WAMP for your local WordPress installation, you can easily find the location of php. ini by right-clicking on the program icon and navigating to PHP > php. ini. That's it.

Where is PHP ini file in Ubuntu?

The default location for the php. ini file is: Ubuntu 16.04: /etc/php/7.0/apache2.