Jump to content
Jikdor

allow_url_fopen turned off on my host, use cURL instead?

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?

Share this post


Link to post
Share on other sites

I have exactly the same issue...any idea how we can do automatic updates using cURL instead?

Share this post


Link to post
Share on other sites

Anyone help with this? I have the same issue (Namesco) it stops me from auto upgrading, from installing new localisations etc

Share this post


Link to post
Share on other sites

I also have this problem.

 

Furthermore the hosting provider doesn't allow to have custom php.ini for my site.

 

Anyone can help this?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Your solution isn't good for me: my hosting provider recommended me to let disabled allow_url_fopen for security reasons

Share this post


Link to post
Share on other sites

Well, in that case I wouldn't know.

My provider had it turned off by default as well for security reasons, but allowed me to enable it if I'd really need it.

Share this post


Link to post
Share on other sites

my hosting provider is cgi so can not detect by ps code.hiks

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites

 

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 !

Share this post


Link to post
Share on other sites

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;
  }
  • Like 2

Share this post


Link to post
Share on other sites

 

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

Share this post


Link to post
Share on other sites

I would also like to know how to change from fopen to curl, because the fopen is turned off by host.

Could anyone write, where to change the code, so all will know what to do, please.

 

Thank you.

Edited by RokA (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

 

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 sorry for disturbing you again, where to put this code? thanks trev

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More