Search code examples
phpapachepermissionssuphp

smarty and suphp permissions - saving as different user


Right now i have to give 777 permission to the directory where files are saved and instead of saving it as "user1" is saving it as apache

-rwxrwxrwx 1 apache apache 6865 Aug 30 17:20 homepage.tpl.php

How can the files be saved as user1 and without 777 permission outside my docroot wich is home/user1/public_html/

lets say in /home/user1/private/homepage.tpl.php

Im using a Centos LAMP with suPHP.

Thanks in advance.


Solution

  • Solved

    To fix it I had to reinstall suphp with this conf.

    /etc/suphp.conf

    check_vhost_docroot=true

    and use the correct handlers

    [handlers]
    ;Handler for php-scripts
    x-httpd-php="php:/usr/bin/php-cgi"
    
    ;Handler for CGI-scripts
    x-suphp-cgi="execute:!self"
    

    Inside the virtual host

    suPHP_Engine on
    suPHP_UserGroup user user
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php