Monthly Archives: September 2010

SME Server open_basedir for Pear extensions

Following on from my run in with the open_basedir process for the /tmp folder during a setup of SugarCRM on SME Server.

I today discovered that SugarCRM wants to use some PEAR extensions and that we again failed on the open_basedir option.

So following that earlier process I now have added

/usr/share/pear:/usr/share/pear-addons

to the open_basedir string in the http conf for the ibays.

SME Server httpd.conf open_basedir path to include /tmp

Working with SugarCRM at the moment with a dev install on my SME Server 8.0b5 in an ibay.

Trying to upload some updates using the SugarCRM admin tool Upgrade Wizard but I kept getting an error stating that ‘Missing a Temporary Folder’. Which is kind of cryptic and Sugar could do well to include the missing folder name that it thinks it needs as that would shorten the research process.

Anywho, the issue can be tracked in the appropriate meesages file, /var/log/messages in the case of SME Server.

The log indicates that Sugar is wanting access to the /tmp directory for the upload and that this directory is outside the open_basedir restrictions that SME Server configures for iBays.

The quick steps for this are:

server#mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
server#cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
server#cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays .
server#mcedit 95AddType00PHP2ibays

I use mcedit for editing, but you might be a vi guru, just substitute mcedit for your favourite editor.
Once you are editing the file look for the output line near the end, it should look like this

my $basedir = $ibay->prop(‘PHPBaseDir’)
|| (“/home/e-smith/files/ibays/” . $ibay->key . “/”);
$OUT .= ” php_admin_value open_basedir $basedirn”;
$OUT .= “n”;

and you need to modify the first .OUT line to include the /tmp directory

my $basedir = $ibay->prop(‘PHPBaseDir’)
|| (“/home/e-smith/files/ibays/” . $ibay->key . “/”);
$OUT .= ” php_admin_value open_basedir $basedir:/tmpn”;
$OUT .= “n”;

Save that file and rebuild the template, restart apache and the uploads should now be ok. Note that this modification does apply this to ALL iBays. Which suits me.

server#/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
server#apachectl restart

and that is done.