Feeds

Issue with PHP configured to SAFE MODE

PerformancingAds
Submitted by Jonathan Evatt on October 10, 2006 - 5:06am in

Hello,
I am using the P Metrics plugin for Wordpress.
I have an issue that appears to result from PHP being configured to run in SAFE MODE. Apparently this makes PHP more secure, and my ISP has decided to implement this measure.

The error generated is this: (only visible in Firefox, as IE just reports various errors but displays none of the Pmetrics output)

-------------------
Performancing Metrics

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/feal/public_html/blog2/wp-content/plugins/pmetrics.php on line 375

Visits: »
Today: 12
Yesterday: 18
This Week: 30
Last Week: 54
Total: 1442

Fetched at: Oct 9, 16:58

Options | Update Stats
---------------------------------

Does anyone know anything about this and whether there is any work around?
Also, does anyone know enough about PHP to tell me where to get information on how to set up PHP securely without resorting to SAFE MODE?

With thanks,

Jonathan Evatt


Update - issue caused by open_basedir

I have now found out from the host that safe_mode is not on. Rather open_basedir is on so that users can not see other users files, which sounds wise and like a fairly typical arrangement.

So typical, in fact, that I am surprised the P Metrics plugin needs this setting OFF, because I doubt many hosting companies would have it turned off.

I'd greatly appreciate hearing if anyone knows of a work-around for this issue.

With thanks,

Jonathan

The first workaround which

The first workaround which comes to my mind is to disable the PMetrics WP-plugin and the code it has (?) embedded to your site.

The second step for this workaround to work is to integrate the standard PMetrics code into your footer template.

Sorry, I am no developer and no WP user but both steps make sense if the WP-plugin causes problems because of server configuration.

I'm afraid the developer of

I'm afraid the developer of the plugin, Dave Reid, has not been around for a while and his site is down so you might be better to do as Markus says and disable it until Dave resurfaces.

Thanks

Okay... so it sounds like the only option is to disable the plugin entirely...meaning that there is no way to display PM data on my WP blog. Oh well... I shall turn it off.

Yes, I noticed Dave's site was closed for now (apparently being updated.

Thanks,

Jonathan

The Work around

Okay... I have found the way to solve this.

Simply comment out the following line (at line 375 in my pmetrics.php file (the exact line number is referred to in the error, so easy to ascertain).

//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

The same result can also be achieved by setting it to FALSE and leaving it without commenting it out.

Either way, this gets rid of the error and the plug still seems to work fine.
I have no idea what exactly this line of code is meant to do as I know nothing about PHP programming. If anyone can suggest what it does please advise.

The code segment is as follows:
-------------------
// Initiate cURL and set options
$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, $header);
-------------------

Cheers,
Jonathan

As PMetrics is also counting

As PMetrics is also counting comments the cURL might be he comment URL. It could also be the counter URL but as you say it still works fine then it is probably the comment URL.

Just a wild guess :-)

Not a workaround

follow_location is required to make curl automatically follow location. Disabling it disables the functionality. Depending on your plugin and configuration, it may or may not be required. However it is not a general solution.

It's also possible to write

It's also possible to write a small loop to make Curl follow the location manually - kind of a pain to have to do it, but doable.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <h2> <h3> <h4> <img> <div> <a> <em> <strong> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <span> <table> <td> <tr> <caption> <th> <hr> <pre> <br> <p> <object> <param> <embed> <strike>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.