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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF