Koozali.org: home of the SME Server

php5 for user web space

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
php5 for user web space
« on: March 29, 2009, 08:10:15 PM »
can someone help to merge
this two pieces of code...

the template
94UserWebPhp

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 .= " 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
and the code from the howto http://wiki.contribs.org/PHP5
that enable php5 using cgi.
Code: [Select]
<Directory /opt/[myapp]>
       AddHandler php5-cgi .php
       Action php5-cgi /php5-cgi/php-cgi
</Directory>

Offline lancelott2

  • *
  • 73
  • +0/-0
  • Ich bin Lancelott2
    • Meine private Homepage
Re: php5 for user web space
« Reply #1 on: March 30, 2009, 06:21:14 AM »
Hello,

what are u planing to do?

Greetings

Lance
---------------------------------------------------------------------
Auch ich lerne noch ständig dazu!
---------------------------------------------------------------------

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #2 on: March 31, 2009, 11:57:08 AM »
enable php5 for user space that already work with php.
some new plugin for wordpress works only with php5.

Offline David Harper

  • *
  • 653
  • +0/-0
  • Watch this space
    • Workgroup Technology Solutions
Re: php5 for user web space
« Reply #3 on: March 31, 2009, 12:14:59 PM »
Try installing the Wordpress contrib, and then following the instructions to enable PHP5 for /opt/wordpress.

Offline Stefano

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

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #5 on: March 31, 2009, 12:18:52 PM »
exactly

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #6 on: March 31, 2009, 12:23:53 PM »
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..

Offline David Harper

  • *
  • 653
  • +0/-0
  • Watch this space
    • Workgroup Technology Solutions
Re: php5 for user web space
« Reply #7 on: March 31, 2009, 12:24:36 PM »
My mistake.

Offline Stefano

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

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 == '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
« Last Edit: March 31, 2009, 12:48:48 PM by Stefano a.k.a. nenonano »

Offline David Harper

  • *
  • 653
  • +0/-0
  • Watch this space
    • Workgroup Technology Solutions
Re: php5 for user web space
« Reply #9 on: March 31, 2009, 01:30:38 PM »
Happy to write the code, but it will need to go in the userspace contrib, which would then depend on PHP5.

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #10 on: March 31, 2009, 10:35:59 PM »
david any suggest??

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: php5 for user web space
« Reply #11 on: March 31, 2009, 10:41:42 PM »
david any suggest??

did you try the solution I gave  you?

Stefano

Offline redteo

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

Offline Stefano

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

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

Offline redteo

  • *
  • 122
  • +0/-0
    • redteo blog
Re: php5 for user web space
« Reply #14 on: March 31, 2009, 11:05:29 PM »
i will try this code tomorrow morning.
i tried in a similar way yesterday but i get apache error..