Download & Extend

Error: open_basedir restriction in effect

Project:Beautify
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:psynaptic
Status:active

Issue Summary

When I uploaded Beautify to a client's shared hosting account, this error flooded the Administration page repeatedly. The cause was that, on lines 536 and 558, Beautify does some file_exists() to try to find the HTML Tidy binary without suppressing errors with a @. I intended to just add the @, but I ended up refactoring the whole function based on these premises;

For one, searching through various likely directories for the Tidy binary is not very clean. This code instead (assuming the server is not running Windows) runs "which tidy" and has the OS tell it where Tidy is located instead of guessing.

For two, the code should first check for a binary inside a subdirectory of the module instead of checking for it elsewhere in the filesystem first. If someone has put a binary in the subdirectory, they clearly intend for the module to use that binary, even if the OS already has it installed elsewhere. That way, a user on a shared hosting environment or similar can easily have Beautify a newer version of Tidy than what their OS has preinstalled.

There's still a problem where, if the module stores the location of Tidy elsewhere on the filesystem and the user later puts a different binary in a subdirectory, the module won't bother looking for the new binary; I'm not entirely sure how that should be worked around outside of reinstalling the module.

AttachmentSize
which.diff3.94 KB

Comments

#1

Oops.

AttachmentSize
which.diff 3.97 KB

#2

Assigned to:Anonymous» psynaptic
Status:active» needs review

That's great, thanks a lot for your efforts on this.

I have to admit - I just copied a lot of the HTML Tidy code from the htmltidy Drupal module.

I'll apply it to both branches. Looks good. :)

Anyone other testers fancy having a go with this patch?

#3

Status:needs review» fixed

Ok, finally got this committed. Thanks again for the help!

http://drupal.org/cvs?commit=168408
http://drupal.org/cvs?commit=168435

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#5

Category:bug report» task
Status:closed (fixed)» active

HTML tidy was downloaded and placed in the beautify module folder on a shared web host.
This host has ssh access and the 'which tidy' command returned no results (the 'which patch' command works so 'which' is functional).

As a result the latest beautify module 6.x-1.x-dev (2009-Feb-01) can not find tidy. Applying the patch which_0.diff also fails so a path was hard coded.

Can the admin settings provide an interface for the user to set the path?

Thanks.

nobody click here