Ways to increase various memory, runtime and filesize limits for a PmWiki installation.
These instructions allow PmWiki to handle larger files and larger or more complex wiki pages. For example, while processing large PageLists, PmWiki reads the files and collects the data, sorts the data and renders the page to the browser, this may require more time and memory. Rendering large page histories too. With a gallery recipe generating a thumbnail, the larger the original picture, the more time and memory will be needed.
The configuration can be done in one of these files:
- in the file local/config.php (for the PmWiki installation only),
- in a .htaccess file (on some Apache servers, for all PHP scripts in the directory)
- in a .user.ini file (for PHP 5.3+/CGI/FastCGI, for scripts in the directory)
- in the file httpd.conf (on some Apache servers, for the whole domain or server)
- in the file php.ini (on some servers, for all PHP scripts)
The last four options may not be available for some or most shared hosting plans.
You can see all possible PHP directives.
Set near the beginning of pmwiki/local/config.php something like this:
ini_set('memory_limit', '64M'); ini_set('max_execution_time', 60); ini_set('post_max_size', '12M'); # may not work in some cases ini_set('upload_max_filesize', '10M'); # may not work in some cases
The values 64M, 12M and 10M are in megabytes (you can change them). The value 60 for max_execution_time is in seconds.
.htaccess or httpd.conf
The file httpd.conf can be located with other program files of the Apache server installation. Refer to your system documentation to find it. On most shared hosting plans, admins cannot edit their httpd.conf file.
The file .htaccess can be located in the directory with pmwiki.php or index.php. If it doesn't exist, you can create it; note that this usually is a "hidden" file and you may need to configure your file/FTP browser to show hidden files. On some hosting plans, this configuration may not work: if you see an "internal server error", just remove them and try the config.php section.
The format for both files is the same.
php_value memory_limit 64M php_value post_max_size 12M php_value upload_max_filesize 10M php_value max_execution_time 60
These lines can be anywhere in a .htaccess file. In a httpd.conf file, they should be inside
<VirtualHost *></VirtualHost> or <Directory /path/to/htdocs></Directory> blocks.
After you change httpd.conf, you may have restart the server.
php.ini or .user.ini
The file php.ini can be located with other program files of the PHP installation, or in a directory conf.d of the server installation, or in the directories /etc/php5/cgi or /etc/php5/apache2. Refer to your system documentation to find it. On most shared hosting plans, admins cannot edit their php.ini file.
The file .user.ini can be located in the directory with pmwiki.php or index.php. If it doesn't exist, you can create it; note that this usually is a "hidden" file and you may need to configure your file/FTP browser to show hidden files. This file will only work for PHP version 5.3 or newer, and in a CGI/FastCGI environment.
The format for both files is the same. In php.ini the directives already exist and you can find them and change their values, in .user.ini you may need to add the full lines:
memory_limit = 64M post_max_size = 12M upload_max_filesize = 10M max_execution_time = 60
After you change php.ini, you may have restart the server.
- A gallery recipe, creating thumbnails from larger pictures, loads the large picture, and this usually needs more memory than the file size. In bytes, PHP needs 3 times the number of pixels in a color picture, and 4 times if the picture has alpha/transparency levels. To load a 5 mega-pixel JPEG photo, the PHP program will normally require 15 megabytes of memory (slightly more to process it).
- UploadsAdmin you can set limits to PmWiki about attachment sizes (the defaults are quite small).
- Petko is the maintainer of this recipe (5ko [snail] 5ko [period] fr).
- If this recipe helps you or saves you time, you can help support its continued development by ♥ .