1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Overriding php values doesn't work in Plesk 10.x

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by Matthew James, May 10, 2011.

  1. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    Hi all,

    Unless I'm missing something here, the old method of creating a vhost.conf file in the conf directory for a vhost does not seem to work anymore.

    I have the following in /var/www/vhosts/domain.com/conf/vhost.conf

    <Directory /var/www/vhosts/domain.com/httpdocs/>
    php_admin_value register_globals on
    </Directory>

    Then:

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com

    But register_globals is still set to off for the vhost and I don't particularly want to turn it on for the whole server since it will be deprecated soon enough. All it seems to do is create a new http.include file in the vhost's conf directory each time.

    I tried restarting apache just in case but it still doesn't work.

    Any ideas how to get this working in 10.x?

    Thanks
     
  2. EugeneL

    EugeneL Regular Pleskian

    20
    57%
    Joined:
    Feb 18, 2011
    Messages:
    461
    Likes Received:
    0
    Hi, Matthew

    Could you please post here the output of the following commands:
    1. ls -la /var/www/vhosts/domain.com/conf/
    2. cat /var/www/vhosts/domain.com/conf/<httpd.include>

    Please replace <httpd.include> with the correct include file - find the one with the greatest numeric prefix.
     
    Last edited: May 10, 2011
  3. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    Hi EugeneL,

    Below is what you asked for, please note, I have replaced the domain with domain.com and the ip address with xx.xxx.xxx.xx

    [root@aries ~]# ls -al /var/www/vhosts/domain.com/conf/vhost.conf
    -rw-r--r-- 1 root root 112 May 11 02:14 /var/www/vhosts/domain.com/conf/vhost.conf

    [root@aries conf]# cat 13050764810.42563300_httpd.include
    # ATTENTION!
    # DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
    # FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
    # MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
    # FOLLOWING FILE(S):
    #/var/www/vhosts/domain.com/conf/vhost.conf
    #/var/www/vhosts/domain.com/conf/vhost_ssl.conf
    <IfModule mod_ssl.c>

    <VirtualHost xx.xxx.xxx.xx:443>
    ServerName "domain.com:443"
    ServerAlias "www.domain.com"
    UseCanonicalName Off

    <IfModule mod_suexec.c>
    SuexecUserGroup "domainco" "psacln"
    </IfModule>

    ServerAdmin "test@domain.com"

    DocumentRoot "/var/www/vhosts/domain.com/httpdocs"
    CustomLog /var/www/vhosts/domain.com/statistics/logs/access_ssl_log plesklog
    ErrorLog "/var/www/vhosts/domain.com/statistics/logs/error_log"



    <IfModule mod_userdir.c>
    UserDir "/var/www/vhosts/domain.com/web_users"
    </IfModule>

    ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.com/cgi-bin/"



    Alias "/plesk-stat" "/var/www/vhosts/domain.com/statistics"
    <Location /plesk-stat/>
    Options +Indexes
    </Location>
    <Location /plesk-stat/logs/>
    Require valid-user
    </Location>
    Alias /webstat /var/www/vhosts/domain.com/statistics/webstat
    Alias /webstat-ssl /var/www/vhosts/domain.com/statistics/webstat-ssl
    Alias /ftpstat /var/www/vhosts/domain.com/statistics/ftpstat
    Alias /anon_ftpstat /var/www/vhosts/domain.com/statistics/anon_ftpstat

    Alias /awstats-icon /var/www/html/awstats/icon



    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile /usr/local/psa/var/certificates/certVjU6289

    <Directory /var/www/vhosts/domain.com/httpdocs>

    <IfModule mod_perl.c>
    <Files ~ (\.pl$)>
    SetHandler perl-script
    PerlHandler ModPerl::Registry
    Options ExecCGI
    allow from all
    PerlSendHeader On
    </Files>
    </IfModule>
    <IfModule mod_perl.c>
    <Files ~ (\.asp$)>
    SetHandler perl-script
    PerlHandler Apache::ASP
    PerlSetVar Global /tmp
    </Files>
    </IfModule>
    <IfModule mod_python.c>
    <Files ~ (\.py$)>
    SetHandler python-program
    PythonHandler mod_python.cgihandler
    </Files>
    </IfModule>
    <IfModule mod_fcgid.c>
    <Files ~ (\.fcgi)>
    SetHandler fcgid-script
    Options +FollowSymLinks +ExecCGI
    </Files>
    </IfModule>
    <Files ~ (\.php)>
    SetHandler None
    AddHandler php-script .php
    Options +ExecCGI
    allow from all
    </Files>

    SSLRequireSSL

    Options +Includes +ExecCGI

    </Directory>



    <Directory "/var/www/vhosts/domain.com/httpdocs/admin">
    AuthType Basic
    AuthName "The Forum Admin"
    AuthUserFile "/var/www/vhosts/domain.com/pd/d..httpdocs@admin"
    require valid-user
    </Directory>
    <Directory "/var/www/vhosts/domain.com/statistics">
    AuthType Basic
    AuthName "Domain statistics"
    AuthUserFile "/var/www/vhosts/domain.com/pd/d..httpdocs@plesk-stat"
    require valid-user
    </Directory>
    Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs"
    ErrorDocument 400 "/error_docs/bad_request.html"
    ErrorDocument 401 "/error_docs/unauthorized.html"
    ErrorDocument 403 "/error_docs/forbidden.html"
    ErrorDocument 404 "/error_docs/not_found.html"
    ErrorDocument 500 "/error_docs/internal_server_error.html"
    ErrorDocument 405 "/error_docs/method_not_allowed.html"
    ErrorDocument 406 "/error_docs/not_acceptable.html"
    ErrorDocument 407 "/error_docs/proxy_authentication_required.html"
    ErrorDocument 412 "/error_docs/precondition_failed.html"
    ErrorDocument 415 "/error_docs/unsupported_media_type.html"
    ErrorDocument 501 "/error_docs/not_implemented.html"
    ErrorDocument 502 "/error_docs/bad_gateway.html"
    ErrorDocument 503 "/error_docs/maintenance.html"



    </VirtualHost>

    </IfModule>

    <VirtualHost xx.xxx.xxx.xx:80>
    ServerName "domain.com:80"
    ServerAlias "www.domain.com"
    UseCanonicalName Off

    <IfModule mod_suexec.c>
    SuexecUserGroup "domainco" "psacln"
    </IfModule>

    ServerAdmin "test@domain.com"

    DocumentRoot "/var/www/vhosts/domain.com/httpdocs"
    CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
    ErrorLog "/var/www/vhosts/domain.com/statistics/logs/error_log"



    <IfModule mod_userdir.c>
    UserDir "/var/www/vhosts/domain.com/web_users"
    </IfModule>

    ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.com/cgi-bin/"



    Redirect permanent /plesk-stat https://domain.com/plesk-stat
    Redirect permanent /webstat https://domain.com/webstat
    Redirect permanent /webstat-ssl https://domain.com/webstat-ssl
    Redirect permanent /ftpstat https://domain.com/ftpstat
    Redirect permanent /anon_ftpstat https://domain.com/anon_ftpstat
    Redirect permanent /awstats-icon https://domain.com/awstats-icon


    <IfModule mod_ssl.c>
    SSLEngine off
    </IfModule>

    <Directory /var/www/vhosts/domain.com/httpdocs>

    <IfModule mod_perl.c>
    <Files ~ (\.pl$)>
    SetHandler perl-script
    PerlHandler ModPerl::Registry
    Options ExecCGI
    allow from all
    PerlSendHeader On
    </Files>
    </IfModule>
    <IfModule mod_perl.c>
    <Files ~ (\.asp$)>
    SetHandler perl-script
    PerlHandler Apache::ASP
    PerlSetVar Global /tmp
    </Files>
    </IfModule>
    <IfModule mod_python.c>
    <Files ~ (\.py$)>
    SetHandler python-program
    PythonHandler mod_python.cgihandler
    </Files>
    </IfModule>
    <IfModule mod_fcgid.c>
    <Files ~ (\.fcgi)>
    SetHandler fcgid-script
    Options +FollowSymLinks +ExecCGI
    </Files>
    </IfModule>
    <Files ~ (\.php)>
    SetHandler None
    AddHandler php-script .php
    Options +ExecCGI
    allow from all
    </Files>


    Options +Includes +ExecCGI

    </Directory>



    <Directory "/var/www/vhosts/domain.com/httpdocs/admin">
    AuthType Basic
    AuthName "The Forum Admin"
    AuthUserFile "/var/www/vhosts/domain.com/pd/d..httpdocs@admin"
    require valid-user
    </Directory>
    <Directory "/var/www/vhosts/domain.com/statistics">
    AuthType Basic
    AuthName "Domain statistics"
    AuthUserFile "/var/www/vhosts/domain.com/pd/d..httpdocs@plesk-stat"
    require valid-user
    </Directory>
    Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs"
    ErrorDocument 400 "/error_docs/bad_request.html"
    ErrorDocument 401 "/error_docs/unauthorized.html"
    ErrorDocument 403 "/error_docs/forbidden.html"
    ErrorDocument 404 "/error_docs/not_found.html"
    ErrorDocument 500 "/error_docs/internal_server_error.html"
    ErrorDocument 405 "/error_docs/method_not_allowed.html"
    ErrorDocument 406 "/error_docs/not_acceptable.html"
    ErrorDocument 407 "/error_docs/proxy_authentication_required.html"
    ErrorDocument 412 "/error_docs/precondition_failed.html"
    ErrorDocument 415 "/error_docs/unsupported_media_type.html"
    ErrorDocument 501 "/error_docs/not_implemented.html"
    ErrorDocument 502 "/error_docs/bad_gateway.html"
    ErrorDocument 503 "/error_docs/maintenance.html"


    Include "/var/www/vhosts/domain.com/conf/vhost.conf"

    </VirtualHost>

    Thanks
     
  4. EugeneL

    EugeneL Regular Pleskian

    20
    57%
    Joined:
    Feb 18, 2011
    Messages:
    461
    Likes Received:
    0
    Hi, Matthew,

    It looks like you switched PHP into CGI/FastCGI mode and try to use vhost.conf to override PHP configuration variables.
    It won't work, vhost.conf and vhost_ssl.conf will do something only when PHP will be run as Apache module.

    Unfortunately in 10.2 there is no documented way how to set up custom php.ini file for site in case of CGI/FastCGI mode.
     
  5. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    Hi EugeneL,

    That's correct, PHP is running as a CGI module so that scripts are run by the owner rather than apache.

    Perhaps this is something that should be sent to the developers, since there's no reason why this shouldn't be possible?

    Thanks
    Matt
     
  6. EugeneL

    EugeneL Regular Pleskian

    20
    57%
    Joined:
    Feb 18, 2011
    Messages:
    461
    Likes Received:
    0
    Our developers already have this feature request and this feature will be implemented.
    But I can't give you any ETA about this.
     
  7. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    Ok, thanks.
     
  8. OcchioD

    OcchioD Guest

    0
     
    Any news about this issue? We reply heavily on the vhost.conf and would like to use it in combination with CGI
     
  9. GiorgosI

    GiorgosI Basic Pleskian

    21
    73%
    Joined:
    Nov 6, 2009
    Messages:
    64
    Likes Received:
    3
    There is a solution since Plesk 9 when php is running as cgi/fastcgi.
    Check the kb article:
    http://kb.odin.com/en/9059

    I have applied it to Plesk 10 and it works.
    On the second step, when you give the command:
    # cat /etc/psa/psa.conf |grep CGI_PHP
    you won't get anything but file cgi_wrapper is still at same location:
    /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
     
  10. GiorgosI

    GiorgosI Basic Pleskian

    21
    73%
    Joined:
    Nov 6, 2009
    Messages:
    64
    Likes Received:
    3
    Yes, I have tried it with Plesk 10.2 and it works just fine.
     
Loading...