Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: cactus on July 29, 2005, 11:29:11 PM
-
I managed to get PEAR up and running in an ibay (already prepared for PHP support in the server-admin module on a SME 6.01 box) and just want to let you know how I did it, maybe some one else can profit from it. Comments are welcome!
Jonathan
Adding PEAR support to an ibay
Note: replace the text and the point brackets with the correct values
- copy template 95AddType00PHP2ibays from /etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays to /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
- enter the following lines under the basedir insertions statements:
my $safe_mode_iclude_dir = db_get_prop(\%accounts, $key, 'PHPSafeModeIncludeDir');
if (safe_mode_iclude_dir)
{
$OUT .=
" phph_admin_value safe_mode_include_dir $safe_mode_include_dir\n";
}
- save the script
- issue the following command to see the current setting of the PHPBaseDir and write it down (you will need it in the next step)
/sbin/e-smith/db accounts getprop <ibayname> PHPBaseDir
- issue the following commands on the command line to add the PEAR directory to the basedir statement
/sbin/e-smith/db accounts setprop <ibayname> PHPBaseDir <old PHPBaseDir>:</path/to/pear>
/sbin/e-smith/db accounts setprop <ibayname> PHPSafeModeIncludeDir </path/to/pear>
/sbin/e-smith/signal-event ibay-modify <ibayname>
- expand the httpd.conf template to include the newly added values
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
- restart the httpd deamon
/etc/e-smith/events/actions/restart-httpd-graceful
Removing PEAR support from an ibay
- issue the following command to see the current setting of the PHPBaseDir and write it down (you will need it in the next step)
/sbin/e-smith/db accounts getprop <ibayname> PHPBaseDir
- issue the following commands on the command line to add the PEAR directory to the basedir statement
/sbin/e-smith/db accounts delprop <ibayname> PHPSafeModeIncludeDir
/sbin/e-smith/db accounts delprop <ibayname> PHPBaseDir
/sbin/e-smith/db accounts setprop <ibayname> PHPBaseDir <old PHPBaseDir without the /path/to/pear>
/sbin/e-smith/signal-event ibay-modify <ibayname>
- expand the httpd.conf template to update the changes
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
- restart the httpd deamon
/etc/e-smith/events/actions/restart-httpd-graceful
-
- copy template 95AddType00PHP2ibays from /etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays to /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
- enter the following lines under the basedir insertions statements:
my $safe_mode_iclude_dir = db_get_prop(\%accounts, $key, 'PHPSafeModeIncludeDir');
if (safe_mode_iclude_dir)
{
$OUT .=
" phph_admin_value safe_mode_include_dir $safe_mode_include_dir\n";
}
- save the script
A few errors in that part :
- a missing 'n' in iNclude
- a missing '$' at the beginning of the variable name
- an 'h' that has nothing to do here
That gives us :
my $safe_mode_include_dir = db_get_prop(\%accounts, $key, 'PHPSafeModeIncludeDir');
if ($safe_mode_include_dir)
{
$OUT .= " php_admin_value safe_mode_include_dir $safe_mode_include_dir\n";
}
Anyway, thanks alot for that howto, it's been very usefull for me.
-
Hi,
I'm working with SME7RC1 and I'm butchering the httpd.conf template. Not sure how, but I get an error message when expanding the template. If anybody has any ideas, I'd appreciate it.
[root@monkey ~]# expand-template /etc/httpd/conf/httpd.conf
ERROR in /etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/95AddType00PHP2ibays: Program fragment delivered error <<Bad name after PHPSafeModeIncludeDir' at /etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/95AddType00PHP2ibays line 20.>> at template line 1
ERROR: Template processing failed for //etc/httpd/conf/httpd.conf: 1 fragment generated errors
at /sbin/e-smith/expand-template line 45
Line #20 looks like this:
my $safe_mode_include_dir = db_get_prop(\%accounts, $key, PHPSafeModeIncludeDir');
The 95AddType00PHP2ibays file looks like this.
{
my $status = $php{status} || 'disabled';
if ($status eq 'enabled')
{
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open_ro();
foreach my $ibay ($adb->ibays)
{
local $dynamicContent = $ibay->prop('CgiBin') || 'disabled';
if ($dynamicContent eq 'enabled')
{
$OUT .= "\n<Directory /home/e-smith/files/ibays/" . $ibay->key . "/html>\n";
$OUT .= " AddType application/x-httpd-php .php .php3 .phtml\n";
$OUT .= " AddType application/x-httpd-php-source .phps\n";
# Set the sandbox within which PHP is confined to play
my $basedir = $ibay->prop('PHPBaseDir')
|| ("/home/e-smith/files/ibays/" . $ibay->key . "/");
my $safe_mode_include_dir = db_get_prop(\%accounts, $key, PHPSafeModeIncludeDir');
if ($safe_mode_include_dir)
{
$OUT .= " php_admin_value safe_mode_include_dir $safe_mode_include_dir\n";
}
$OUT .= " php_admin_value open_basedir $basedir\n";
$OUT .= "</Directory>\n";
}
}
}
}
-
It's because of a missing quote in my post ('PHPSafeModeIncludeDir'), sorry.
I just edited my post to correct that.
-
Oh...
That was pretty obvious. I should have caught that. Thanks.
-
Hallo,
on my SME 6.0.1 I need to enable PEAR in an ibay for egroupware.
I follwoed the script until:
/sbin/e-smith/db accounts getprop <ibayname> PHPBaseDir
Here I used /sbin/e-smith/db accounts getprop egroupware PHPBaseDir but I get no replay.
What's going wrong?
-
912,
Okay... you made a custom template 95AddType00PHP2ibays and then did a command something like this:
db accounts setprop egroupware PHPBaseDir /home/e-smith/files/ibays/egroupware:/usr/share/pear
db accounts setprop egroupware PHPSafeModeIncludeDir /usr/share/pear
Right? And you also expanded the templates?
# Expand the templates
signal-event ibay-modify egroupware
expand-template /etc/httpd/conf/httpd.conf
expand-template /etc/php.ini
service httpd-e-smith restart
Right? What do you get when you look at phpinfo?
-
Try
/sbin/e-smith/db accounts show egroupware
This will show all egroupware settings.
good luck
Jáder