Koozali.org: home of the SME Server
Obsolete Releases => SME 7.x Contribs => Topic started by: redteo on March 29, 2009, 08:10:15 PM
-
can someone help to merge
this two pieces of code...
the template
94UserWebPhp
{
use esmith::AccountsDB;
$OUT = "";
my $accounts = esmith::AccountsDB->open;
my @users = $accounts->users;
foreach my $user (@users)
{
$OUT .= "\n<Directory /home/e-smith/files/users/".$user->key;
$OUT .= "/home/public_html>\n";
$OUT .= " AddType application/x-httpd-php";
$OUT .= " .php .php3 .phtml\n";
$OUT .= " AddType application/x-httpd-php-source .phps\n";
# Set the sandbox within which PHP is confined to play
my $tmppath = "/home/e-smith/files/users/";
$tmppath .= $user->key . "/";
my $basedir = $user->prop('PHPBaseDir') || ($tmppath);
$OUT .= " php_admin_value open_basedir $basedir\n";
$OUT .= "</Directory>\n";
}
}
from the rpm http://www.pialasse.com/RPMS/smeserver-user-webspace-0.1-5.SME7.noarch.rpm (http://www.pialasse.com/RPMS/smeserver-user-webspace-0.1-5.SME7.noarch.rpm)
and the code from the howto http://wiki.contribs.org/PHP5 (http://wiki.contribs.org/PHP5)
that enable php5 using cgi.
<Directory /opt/[myapp]>
AddHandler php5-cgi .php
Action php5-cgi /php5-cgi/php-cgi
</Directory>
-
Hello,
what are u planing to do?
Greetings
Lance
-
enable php5 for user space that already work with php.
some new plugin for wordpress works only with php5.
-
Try installing the Wordpress contrib, and then following the instructions to enable PHP5 for /opt/wordpress.
-
David
as far as I can understand, OP has enabled the user web space contrib.. so he wish to activate php5 per user basis..
my 2c
Ciao
Stefano
-
exactly
-
to explayn more
the php5 contrib that whe can read on the wiki can enable php5
using a cgi in ibays and /opt/yourweb
i think that exist a way to merge the code of this contrib with the template
that posted. this template enable the user to host web pages in the home/public_html..
-
My mistake.
-
ok.. let's try
NOTE this is a workaround, not tested..
1) copy 94UserWebPhp fragment to the same folder in /etc/e-smith/templates-custom tree (you have to create the sub tree manually) and cd to the same dir
2) let's say that you want to give php5 to user john
edit the fragment in this way:
{
use esmith::AccountsDB;
$OUT = "";
my $accounts = esmith::AccountsDB->open;
my @users = $accounts->users;
foreach my $user (@users)
{
$OUT .= " <Directory /home/e-smith/files/users/".$user->key;
$OUT .= "/home/public_html> ";
$OUT .= " AddType application/x-httpd-php";
$OUT .= " .php .php3 .phtml ";
$OUT .= " AddType application/x-httpd-php-source .phps ";
if ($user == 'john') {
$OUT .= "AddHandler php5-cgi .php ";
$OUT .= "Action php5-cgi /php5-cgi/php-cgi ";
}
# Set the sandbox within which PHP is confined to play
my $tmppath = "/home/e-smith/files/users/";
$tmppath .= $user->key . "/";
my $basedir = $user->prop('PHPBaseDir') || ($tmppath);
$OUT .= " php_admin_value open_basedir $basedir ";
$OUT .= "</Directory> ";
}
}
3) save the fragment with Ctrl-X, Y (if you are working with pico)
4) signal-event user-modify john
should do the trick
please raise a NFR to ask that this feature is added to the contrib (maybe David, the mantainer, is interested :wink: )
let us know
Ciao
Stefano
-
Happy to write the code, but it will need to go in the userspace contrib, which would then depend on PHP5.
-
david any suggest??
-
david any suggest??
did you try the solution I gave you?
Stefano
-
if i understud you changed the code only to modify one account.
so is not what i need..
###se sei italiano possiamo parlare su msn###
-
if i understud you changed the code only to modify one account.
so is not what i need..
mine was an example.. did you try it? if it works for a single account, we can modify for many..
###se sei italiano possiamo parlare su msn###
si, sono italiano ma msn ora non posso...
Stefano
p.s. passa anche sul forum in italiano, grazie
-
i will try this code tomorrow morning.
i tried in a similar way yesterday but i get apache error..
-
ok
let us know if it works.. if not, post the error message you'll find in /var/log/httpd/error_log file, thank you
Ciao
Stefano
-
get back to this trouble...
i tried the code suggested from stefano.
i applied the settings restarted http service
and tested if php5 is avayable on the user pages..
no error but php is version ..
i'm not sure but sims that the modified version das't apply the new text to http.conf
i modified by hand the configuration and this work
but i can immagin that every time i do one upgrade the bad configuration come back.
-
no error but php is version ..
version? :-)
i modified by hand the configuration and this work
well.. then, please, post here:
- the fragment of your working httpd.conf
- the same fragment from the not-working httpd.conf (i.e. the one generated from template)
so we can see the difference and modify the code..
but i can immagin that every time i do one upgrade the bad configuration come back.
of course.. it's the way SME works
Ciao
Stefano
p.s. I didn't see you on italian forum..
-
OOOPpsss.
i wrongly applied the settings with your changes.
i did this now and after
signal-event post-upgrade
signal-event reboot
i get erroron reboot from apache:
i tried to find the error in the log like you said but nothing here...
tomorrow i try the same and i i copy the error that in can see on the screen
during the boot and the wrong lines on httpd.conf ..
now the reponse to your latest post.
user web space code from the rpm
---8<-------
#-------------------------------------------------------
# Alias to enable /user aswell as /~user access
#-------------------------------------------------------
Alias /redteo /home/e-smith/files/users/redteo/home/public_html
Alias /user1 /home/e-smith/files/users/user1/home/public_html
Alias /user2 /home/e-smith/files/users/user2/home/public_html
Alias /user3 /home/e-smith/files/users/user3/home/public_html
Alias /user4 /home/e-smith/files/users/user4/home/public_html
#-------------------------------------------------------
#Generic user dir access directive
#-------------------------------------------------------
<Directory /home/e-smith/files/users/*/home/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Order deny,allow
Deny from all
</Limit>
</Directory>
----8<------
cutted part
----8<------
<Directory /home/e-smith/files/users/redteo/home/public_html>
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
php_admin_value open_basedir /home/e-smith/files/users/redteo/
</Directory>
<Directory /home/e-smith/files/users/userXX/home/public_html>
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
php_admin_value open_basedir /home/e-smith/files/users/userXX/
</Directory>
----8<-----
cutted part
----8<-----
i changed the part
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
with thist code:
AddHandler php5-cgi .php
Action php5-cgi /php5-cgi/php-cgi
i have also to check if the part relative to the basedir is working...
sorry i not have so much time..
stefano i have to put the focus also on the thing that i have more users not one :-/
i think , i try to suggest that the best way is to change the code of the user space template to enable the code for all the users..
p.s: i will write on italian forum for my next topic .
-
now the errors on the boot screen:
Syntax error on line 1876 of /etc/httpd/conf/httpd.conf:
/etc/httpd/conf/httpd.conf:1876: <Directory> was not closed
here the template :
{
use esmith::AccountsDB;
$OUT = "";
my $accounts = esmith::AccountsDB->open;
my @users = $accounts->users;
foreach my $user (@users)
{
$OUT .= " <Directory /home/e-smith/files/users/".$user->key;
$OUT .= "/home/public_html> ";
$OUT .= " AddType application/x-httpd-php";
$OUT .= " .php .php3 .phtml ";
$OUT .= " AddType application/x-httpd-php-source .phps ";
if ($user == 'redteo') {
$OUT .= "AddHandler php5-cgi .php ";
$OUT .= "Action php5-cgi /php5-cgi/php-cgi ";
}
# Set the sandbox within which PHP is confined to play
my $tmppath = "/home/e-smith/files/users/";
$tmppath .= $user->key . "/";
my $basedir = $user->prop('PHPBaseDir') || ($tmppath);
$OUT .= " php_admin_value open_basedir $basedir ";
$OUT .= "</Directory> ";
}
}
the wrong line is the following:
<Directory /home/e-smith/files/users/bagstime.av/home/public_html> AddType application/x-httpd-php .php .php3 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/e-smith/files/users/bagstime.av/ </Directory> <Directory /home/e-smith/files/users/fernanda/home/public_html> AddType application/x-httpd-php .php .php3 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/e-smith/files/users/fernanda/ </Directory> <Directory /home/e-smith/files/users/paolo/home/public_html> AddType application/x-httpd-php .php .php3 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/e-smith/files/users/paolo/ </Directory> <Directory /home/e-smith/files/users/redteo/home/public_html> AddType application/x-httpd-php .php .php3 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/e-smith/files/users/redteo/ </Directory> <Directory /home/e-smith/files/users/trancoso/home/public_html> AddType application/x-httpd-php .php .php3 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/e-smith/files/users/trancoso/home/public_html:/tmp </Directory>
this is one line!! i i not covered the users ;-)
my new step is to change the userweb template like this:
{
use esmith::AccountsDB;
$OUT = "";
my $accounts = esmith::AccountsDB->open;
my @users = $accounts->users;
foreach my $user (@users)
{
$OUT .= "\n<Directory /home/e-smith/files/users/".$user->key;
$OUT .= "/home/public_html>\n";
$OUT .= " AddHandler php5-cgi .php\n";
$OUT .= " Action php5-cgi /php5-cgi/php-cgi\n";
# Set the sandbox within which PHP is confined to play
my $tmppath = "/home/e-smith/files/users/";
$tmppath .= $user->key . "/";
my $basedir = $user->prop('PHPBaseDir') || ($tmppath);
$OUT .= " php_admin_value open_basedir $basedir\n";
$OUT .= "</Directory>\n";
}
after the post-upgrade
all work good, all the users have they web pages with php5, but i'm not prepared to see if the base dir is well configured..
i think the natral way of evolution is to change the php5 contrib to chek if
user space is enabled and automatically overwrite the template ..
please how i can chek if all work good??
:-)
-
now the errors on the boot screen:
Syntax error on line 1876 of /etc/httpd/conf/httpd.conf:
/etc/httpd/conf/httpd.conf:1876: <Directory> was not closed
the wrong line is the following:
]zac[
this is one line!! i i not covered the users ;-)
did you modify the template fragment with a windows editor?
my new step is to change the userweb template like this:
{
use esmith::AccountsDB;
$OUT = "";
my $accounts = esmith::AccountsDB->open;
my @users = $accounts->users;
foreach my $user (@users)
{
$OUT .= "\n<Directory /home/e-smith/files/users/".$user->key;
$OUT .= "/home/public_html>\n";
$OUT .= " AddHandler php5-cgi .php\n";
$OUT .= " Action php5-cgi /php5-cgi/php-cgi\n";
# Set the sandbox within which PHP is confined to play
my $tmppath = "/home/e-smith/files/users/";
$tmppath .= $user->key . "/";
my $basedir = $user->prop('PHPBaseDir') || ($tmppath);
$OUT .= " php_admin_value open_basedir $basedir\n";
$OUT .= "</Directory>\n";
}
the \n character should not be necessary if you edit the fragment directly on SME
after the post-upgrade
all work good, all the users have they web pages with php5, but i'm not prepared to see if the base dir is well configured..
well.. you need simply to test it :-)
i think the natral way of evolution is to change the php5 contrib to chek if
user space is enabled and automatically overwrite the template ..
I disagree.. I think that the user web space contrib has to be modified to check if php5-cli is installed
anyway, I would open a nfr in the bugtracker for it
please how i can chek if all work good??
:-)
well... I think you can simply wait for your users to tell you if something goes wrong..
Ciao
Stefano
-
i use nano to edit files in ssh shell connection.
you can se the template used, that during the postupgrade
done a worng conf file.. maybe a conflict with others template or the code your suggested is wrong. np
look back to my post..
i see that the original template use \n and i did the same following :-/
i don't know the porpuse of openbase dir if it is used to chroot on user dir the use of command (imagemagik etc) it works, and is not a proble, i copied the binari usefull for the user in the user dir changing the skeleton.. (is not nice but work ;-)
i don't know how to raise bugs.. and is the same change php5 or userspace contrib.. the thing is let the people know that we have this opportunity. if you want i can bee you cavia to generate a new rpm for the user space..
OT. and now so sorry for my inprouving english here i'm a self learner :-D