Koozali.org: home of the SME Server

php5 for user web space

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: php5 for user web space
« Reply #15 on: March 31, 2009, 11:11:35 PM »
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

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #16 on: April 16, 2009, 01:09:28 PM »
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.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: php5 for user web space
« Reply #17 on: April 16, 2009, 08:36:44 PM »
no error but php is version ..

version? :-)

Quote
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..

Quote
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..

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #18 on: April 16, 2009, 11:47:29 PM »
OOOPpsss.
i wrongly applied the settings with your changes.
i did this now and after
Code: [Select]
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


Code: [Select]
---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
Code: [Select]
AddType application/x-httpd-php .php .php3 .phtml
 AddType application/x-httpd-php-source .phps
with thist code:
Code: [Select]
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 .

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #19 on: April 18, 2009, 12:14:42 AM »
now the errors on the boot screen:

Code: [Select]
Syntax error on line 1876 of /etc/httpd/conf/httpd.conf:
/etc/httpd/conf/httpd.conf:1876: <Directory> was not closed

here the template :

Code: [Select]
{
    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:

Code: [Select]
<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:

Code: [Select]
{
    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??

:-)



Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: php5 for user web space
« Reply #20 on: April 18, 2009, 09:51:51 AM »
now the errors on the boot screen:

Code: [Select]
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?

Quote
my new step is to change the userweb template like this:

Code: [Select]
{
    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

Quote
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 :-)

Quote
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

Quote
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

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #21 on: April 18, 2009, 04:45:12 PM »
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