Jump to content

allow_url_fopen turned off on my host, use cURL instead?


Jikdor

Recommended Posts

My host (https://www.loopia.se/) have turned off allow_url_fopen for security reasons so I can not see update notifications witch is really anoying :( and they wont turn it on for me, they refer me to use cURL instead. i have no idea how allow_url_fopen or cURL and I'm not really up for some core prestashop moding... Is there some other module that will use cURL instead or do I simply have to change host?

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...
  • 1 month later...
  • 1 month later...
  • 2 weeks later...

I had the same problem.

My hosting provider recommended me to do the following:

 

1. Open a new file with notepad

2. Write this line: allow_url_fopen = 1

3. Save as: php.ini

4. Upload with Filezilla, or any other file-transfer program, in your public_html file, or simply the root folder of your website.

 

Now it should work / Hope it helps

Link to comment
Share on other sites

  • 1 year later...
Hello, 

 

You should use the native Prestashop function : Tools::file_get_contents() 

 

This function verify if fopen is disabled, if it is, the function will use cURL to fetch the data, the result will be the same than with fopen(url) 

 

Enjoy ;)

Link to comment
Share on other sites

  • 3 months later...

 

Hello, 
 
You should use the native Prestashop function : Tools::file_get_contents() 
 
This function verify if fopen is disabled, if it is, the function will use cURL to fetch the data, the result will be the same than with fopen(url) 
 
Enjoy ;)

 

 

Hello Delete, can you or someone please,  give some more information about how to "use the native Prestashop function : Tools::file_get_contents()"

 

My hosting also, and many others have killed the fopen function for security reasons, is there any way to make prestashop work with Curl only?

 

Please someboy help !

Link to comment
Share on other sites

  • 10 months later...

 

you can use function

 public function load_curl($url) {
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    curl_close($curl);
    return $result;
  }

hi vekia, im looking to set f url open in order to use the google analytics api module... where exactly do i paste this code? and what do i set as the URL? thanks

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

This is the kind of support you give to the community and users in general? Well it is too damn sad.

Actually, Prestashop has the worst support forum that I know until now.

He is the answer my friends:

You have to go and edit login_addons.tpl, that is in the next folder: admin/themes/default/template/controllers/modules

 

The only thing you have to do is delete the next lines: 

 

{if $check_url_fopen eq 'ko'  OR $check_openssl eq 'ko'}
<div class="alert alert-warning">
{l s='If you want to be able to fully use the AdminModules panel and have free modules available, you should enable the following configuration on your server:'}
<br />
{if $check_url_fopen eq 'ko'}- {l s='Enable PHP\'s allow_url_fopen setting'}<br />{/if}
{if $check_openssl eq 'ko'}- {l s='Enable PHP\'s OpenSSL extension'}<br />{/if}
</div>
{else}

 

 And One of this at the bottom:

 

{/if}

That's all.

 

Edited by Kadenian (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hi, new Prestashop user here, currently on version 1.6.1.1

A number of searches has brought me to this thread and hopefully some advice regarding the "allow_url_fopen" problem.

 

So, for example, when trying to configure the Ebay module in Modules and Services, I get the following error message:

"...ebay: you must enable allow_url_fopen option on your server if you want to use this module..."

 

also when I log in to the Addons site:

"...If you want to be able to fully use the AdminModules panel and have free modules available, you should enable the following configuration on your server:
- Enable PHP's allow_url_fopen setting..."

 

I contacted my hosting company (Namesco) to ask about this and below is their reply and a possible solution(?):

 

=====================

allow_url_fopen is disabled across all our shared hosting platform, as it poses a security risk from badly-written or malicious scripts. This is a platform-wide setting and cannot be modified.

If you want to include files from third-party sites, then you need to change the code to use PHP's curl() functions instead.

For example:

$file = file_get_contents("http://www.example.com/page.html");

would become

$url = 'http://www.example.com/page.html"';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$file = curl_exec($ch);
curl_close($ch);

======================

 

I wanted to ask anybody here if they may have tried changing the code as described above, whether this worked and, if so, the location of the file that needs to be changed.

 

Thanks for any help and advice.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...