All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Issues with Low Google Search and cURL

JoeGengler 26 Oct 2015 22:24 problem, complete

Hello, I recently moved all my expression engine sites to a new hosting environment. Everything went well except I am seeing an error when trying to render search results.

A PHP Error was encountered

Severity: Warning

Message: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set

Filename: low_googlesearch/mod.low_googlesearch.php

Line Number: 890

I am currently running EE on PHP 5.5.30 on Linux 14.04.3 LTS and Plesk Panel 12.5.30

open_base_dir is online and the plugin should be able to see everything it needs within the directive I set which is the same as my older server and I have enabled allow_url_fopen = On to see if that was the issue but I am still getting no luck. The URL for the results page is public https://unionwellinc.org/expansion/se...

Let me know your thoughts on this one. Thanks!

Replies

  1. Low 27 Oct 2015 07:48

    I'll need to take a look myself. Please send SuperAdmin and FTP login credentials to hi at gotolow dot com if you can.

  2. JoeGengler 27 Oct 2015 17:34

    Low, thanks for the reply. We don't expose our servers to outside world via ftp of sftp. We are a college campus so we get lots of attacks. I can give you CP access for sure. Do you have a method you can remote into my machine? If not I can set something up for you.

  3. Low 27 Oct 2015 17:39

    Hmm, I wanted to check on that environment myself, but to fix the issue, you could probably also just comment out line 890 in mod.low_googlesearch.php.

    I'll need to test a final solution, so I'll make note of that.

  4. JoeGengler 27 Oct 2015 18:53

    Low thanks but if I comment that line out it breaks the plugin and also prevents my sites from loading :-( any other thoughts?

  5. Low 27 Oct 2015 18:57

    What does that line say? It should just say

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);


    and I don't think that should have any implications when you remove it...

  6. JoeGengler 27 Oct 2015 19:47

    Low, so I removed that line instead of commenting it out. Now I am getting the results page to render but no results are be fetched. FYI when I turn openbasedir off everything works fine. I run the web server but we basically run shared hosting. We need to keep that feature on for security reasons. Let me know if you have any other insight. I appreciate your help.

  7. Low 27 Oct 2015 20:21

    You can try and swap the cURL and file_get_contents around.

    Replace the entire _get_results($url) function, starting at line 878, with this: https://gist.github.com/low/3c28a2cca...

  8. JoeGengler 27 Oct 2015 22:37

    Unfortunately still a no go across all of my sites. I can get the pages to render but no results. Does your program log to a location. Maybe I can check that and see if it will give me more direction.

  9. Low 28 Oct 2015 07:02

    Hmm. Running out of options here. Can you email me your full {exp:low_googlesearch:results} tag? hi at gotolow dot com.

  10. JoeGengler 2 Nov 2015 18:34

    Just sent you the requested tag data. Let me know if you need more information.

  11. Low 3 Nov 2015 09:28

    Okay, can you restore the original mod.low_googlesearch.php file and replace line 890 which reads

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);


    with this

    if ( ! @ini_get('open_basedir')) curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);


    And then remove the sitesearch="" parameter from your Results tag?

    With that parameter, I got valid XML back from the API, but no results were included. I'm guessing the sitesearch parameter refers to a non-defined site in the google box. Without it, I get results back.

  12. JoeGengler 4 Nov 2015 18:37

    Hey low I think it has something to do with me being on cloudflare and that search appliance getting bounced off. I was thinking of stopping my use of it. I ended up purchasing Low Search to keep everything internal now. Thanks for the help!