Re: php_admin_value, virtual hosts, & upload_tmp_dir

From: Date: Wed, 18 Oct 2006 00:31:24 +0000
Subject: Re: php_admin_value, virtual hosts, & upload_tmp_dir
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-243264@lists.php.net to get a copy of this message
Chris wrote:
Michael Hogsett wrote:
Why can I not set "upload_max_filesize" or "upload_tmp_dir" inside my virtual host directive? These are exactly the kinds of ini directives that you would want to set per virtual host. I can set "open_basedir" inside my virtual host using php_admin_value, but neither of "upload_max_filesize" nor "upload_tmp_dir" take effect unless I move those directives outside the virtual host configuration and into Apache's global context. Can anyone offer a suggestion as to how I would go about setting, at the very least, "upload_tmp_dir" per virtual host?
I just tried it and it worked: <IfModule mod_php4.c>
    php_admin_flag engine on
    php_admin_value upload_tmp_dir "/php_uploads"
</IfModule> That was inside a virtual host...
Interesting. Here's a snippet from my httpd.conf file. ... NameVirtualHost * ...
php_admin_value upload_tmp_dir      /usr/local/www/subsite/virtual-server-hostname.domain/tmp/uploads/
php_admin_value upload_max_filesize "100M" <VirtualHost *:80>
    ServerAdmin addr@domain
    DocumentRoot /usr/local/www/subsite/virtual-server-hostname.domain/data
    ServerName hostname.domain
    ErrorLog /var/log/hostname.domain-error_log
    CustomLog /var/log/hostname.domain-access_log common
    <Directory "/usr/local/www/subsite/virtual-server-hostname.domain/data">
        Options FollowSymLinks MultiViews Includes
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    php_admin_value open_basedir    "/usr/local/www/subsite/virtual-server-hostname.domain:/usr/local/share/pear"
    <IfModule mod_alias.c>
    ScriptAlias /cgi-bin/ "/usr/local/www/subsite/virtual-server-hostname.domain/cgi-bin/"
    <Directory "/usr/local/www/subsite/virtual-server-hostname.domain/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
    </IfModule>
</VirtualHost> The two outside the VirtualHost work when they're there, but do not work if I move them next to the entry for "open_basedir". My error log states "php_admin_value not allowed here" when I place them there. Oddly it does not compain about the one that is there now. Likewise the only place (other than globally in php.ini) that I've been able to configure the include_path is within the .htaccess file inside my document root directory. I was unable to set this value inside the virtual host either. Perhaps I should wrap the directives in a <IfModule> conditional like you have. I've found the documentation on this to be very vague. - Mike P.S. Yes I want 100 meg uploads enabled, and yes I found out the hard way that I have to alter the max post size too.

Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
« previous php.general (#243264) next »