Bobcares

enable allow_url_fopen : Easy way to access remote data !!

by | Nov 24, 2019

Having trouble when trying to enable allow_url_fopen on your website?

The allow_url_fopen helps to access data from remote servers or websites.

Many times, hosting providers turn off the use of allow_url_fopen function as it can compromise the security of the website.

At Bobcares, we often get requests from our customers to enable allow_url_fopen as part of our Server Management Services.

Today, let’s get into the details on how our Support Engineers enable allow_url_fopen in different cases.

 

Why enable allow_url_fopen?

The allow_url_fopen refers to a PHP directive, which retrieves data from remote servers or websites. Our Support Engineers enable it from the custom/default PHP file according to the requirement.

Usually, hackers make use of this function to retrieve data from remote servers and do malicious acts. This PHP directive is always made disabled in the shared server. Thus, the shared server contains lots of domains, we always keep this as disabled to avoid high-security risk.

The following command checks whether the allow_url_fopen is On or Off.

grep allow_url_fopen /usr/local/lib/php.ini

According to the php.ini file location, there will be a slight variation in the actual command.

 

How to enable allow_url_fopen?

At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers requesting to enable allow_url_fopen.

Now, let’s see how our Support Engineers enable allow_url_fopen  by various methods according to the requirement of the user.

You can enable this via different methods.

 

1. Enabling for a unique website.

Quite often, customers approach us to enable this directive for unique websites (hosted in shared servers). In such cases, we help the customer by enabling it by creating a custom php.ini file under the public_html folder of the website.

According to the PHP handler used in the server, the file to edit the allow_url_fopen will vary.

a) Editing php.ini file

1. Initially, we log in to the server.
2. After that, we create a custom php.ini  file and edit it using vim editor. Here, the allow_url_fopen will be set as disabled(off) for default. So to enable this, we edit this file and add

allow_url_fopen = on

3. Then we save the php.ini file after changing allow_url_fopen to On

4. Finally, we restart the Apache service using

httpd restart

5. Further, we verify it using the info page under the user’s website.

For example:

https://your_domain/phpinfo.php

enable allow_url_fopen

 

b) Altering .htaccess file

In addition to this, when PHP runs as a DSO module, we enable allow_url_fopen by altering the .htaccess file. We added the following code to

php_value allow_url_fopen On

After altering we saved the file. This, in turn, enabled the allow_url_fopen.

 

2. Enabling allow_url_fopen for a server

Recently another customer who was having a dedicated server approached us to enable allow_url_fopen. We assisted the customer by editing the inbuilt php.ini file for enabling allow_url_fopen.

The path of the php.ini file varies according to easyapache 3 servers and easyapache 4 servers.

1. Initially, we logged into the server via SSH as root access.

2. Then using the php –ini command, we identified the path of default php.ini in the server.

In easyapache 3 servers the path is:

/usr/local/lib/php.ini

In easyapache 4 servers (with php version 5.6) the path is:

/opt/cpanel/ea-php56/root/etc/php.ini

3. After that, we edited the directive in php.ini file using vim editor.

allow_url_fopen = On

4. Finally, restart the webserver.

service httpd restart

Enabling via WHM

In addition, for the same case, we also enable allow_url_fopen for a server via WHM.

1. We signed up to WHM panel.

2. Then searched for MultiPHP INI Editor

3. After that we Selected Editor Mode and then selected the php version in Edit the INI settings of a PHP version

4. In that we searched allow_url_fopen, made it as On as follows below:

Allow_url_fopen: On

5 Finally, saved the changes.

For making the changes effective we restarted the Apache server.

 

[Need assistance to enable allow_url_fopen? We’ll help you.]

 

Conclusion

In short, the allow_url_fopen refers to a PHP directive, which retrieves data from remote servers or websites. We can enable this via editing the php.ini, .htaccess, or via WHM interface and so on. Today, we saw how our Support Engineers enabled the allow_url_fopen using different methods.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.