Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: Marcor on January 23, 2006, 10:49:34 PM
-
Smarty is a easy to use PHP template program, and should be ideal to run on the SME webserver. It's easy to install http://smarty.php.net/quick_start.php . But after install I get only blank pages. Seems something in SME prevents Smarty from running.
-
I found the solution, you need to disable the sandbox function.
1. Type in the following commands:
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays
pico 95AddType00PHP2ibays
2. Look for the 'sandbox' section of the file and add hashes to the following lines:
# my $basedir = db_get_prop(%accounts, $key, 'PHPBaseDir') ||
# "/home/e-smith/files/ibays/$key";
# $OUT .=
# " php_admin_value open_basedir $basedirn";
(exit ^X)
3. Type in the following commands:
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
service httpd restart
And Enjoy Smarty also:
-
Smarty installed here :
/usr/lib/php/smarty
My ibay is called "name", and my smarty folder (cache, configs, templates, templates_c) is here :
/home/e-smith/ibays/name/html/smarty
I've modified the "httpd.conf" file like that :
# pico /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays
added this :
# Set the sandbox within which PHP is confined to play
my $basedir = $ibay->prop('PHPBaseDir')
|| ("/home/e-smith/files/ibays/" . $ibay->key . "/");
$OUT .= " php_admin_value open_basedir $basedir";
###############
# SMARTY for ibay "name" - Maelvon - 2007.01.28
#
if ($ibay->key eq 'name')
{
$OUT .= ":/usr/lib/php/smarty/";
}
$OUT .= "\n";
#
###############
Run the command expand-template :
# expand-template /etc/httpd/conf/httpd.conf
And restarted "httpd-e-smith" service :
# service httpd-e-smith restart
I don't know about the security of this code addition, but it works !
If you have any comments ?
And enjoy Smarty !
Maelvon
-
Thanks for your contribution. I guess one of the dangers is that people can upload and execute rootkits.