When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files (e.g. httpd.conf) and .htaccess files. You will need “AllowOverride Options” or “AllowOverride All” privileges to do so.

php_value name value

Sets the value of the specified directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a previously set value use none as the value.

php_flag name on|off

Used to set a boolean configuration directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives.

php_admin_value name value

Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with phpadminvalue can not be overridden by .htaccess or ini_set(). To clear a previously set value use none as the value.

example of php_admin_value

  • how set a path for the openbasedir
    php_admin_value open_basedir /tmp:/usr/share/tt-rss:/var/cache/tt-rss:/var/lock/tt-rss

* how set php limit

php_admin_value memory_limit 128M           # must be superior as post_max_size
php_admin_value post_max_size 110M          # must be superior as upload_max_filesize
php_admin_value upload_max_filesize 100M
php_admin_value max_execution_time 60       # set to '0' for unlimited, Time in seconds

* how set a session path

    php_admin_value session.save_path /var/lib/dokuwiki/data/tmp
  • how set an upload path
php_admin_value upload_tmp_dir /var/lib/dokuwiki/data/tmp

Use Case

Alias /dokuwiki /usr/share/dokuwiki

<Directory /usr/share/dokuwiki>
    AllowOverride None
    Options +FollowSymlinks
    AddType application/x-httpd-php .php
    Order Allow,Deny
    Allow from 127.0.0.1 192.168.12.0/255.255.255.0 
    SSLRequireSSL on
    
    php_admin_value open_basedir /usr/share/dokuwiki:/var/lib/dokuwiki:/etc/dokuwiki
    php_admin_value memory_limit 128M
    php_admin_value upload_max_filesize 200M
    php_admin_value post_max_size 200M
    php_admin_value upload_tmp_dir /var/lib/dokuwiki/data/tmp
    php_admin_value session.save_path /var/lib/dokuwiki/data/tmp
</Directory>

php_admin_flag name on|off

Used to set a boolean configuration directive. This can not be used in .htaccess files. Any directive type set with php_admin_flag can not be overridden by .htaccess or ini_set().