From 8c6b3995d1761289e1fe313d7225ad5b9792cfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 16 Dec 2005 13:57:32 +0000 Subject: [PATCH] Configurable memory limit (RFE #1373904). --- ChangeLog | 2 ++ Documentation.html | 39 ++++++++++++++++++++++-------------- export.php | 3 +++ import.php | 4 ++++ libraries/config.default.php | 1 + 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e074d43a..4e07765de 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ $Source$ * Documentation.html, libraries/common.lib.php, libraries/config.default.php, libraries/database_interface.lib.php: Add support for hiding databases (RFE #1372865). + * Documentation.html, export.php, import.php, + libraries/config.default.php: Configurable memory limit (RFE #1373904). 2005-12-14 Sebastian Mendel * libraries/Config.class.php: diff --git a/Documentation.html b/Documentation.html index 02d8194c8..256df240d 100755 --- a/Documentation.html +++ b/Documentation.html @@ -66,7 +66,7 @@
  • PHP
      -
    • You need PHP 4.1.0 or newer, with session support (*)
    • +
    • You need PHP 4.1.0 or newer, with session support (*)
    • If you want to display inline thumbnails of JPEGs with the original aspect ratio, you also need GD2 support in PHP
    • Starting with phpMyAdmin 2.6.1, MIME-based transformations @@ -343,7 +343,7 @@ GRANT SELECT ( GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'; - (this of course requires that your linked-tables infrastructure be set up). + (this of course requires that your linked-tables infrastructure be set up).
      Of course, the above queries only work if your MySQL version supports the GRANT command. This is the case since 3.22.11. @@ -864,8 +864,8 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'; you want to have on hold. On every login, this list gets cut to the maximum amount.

      - The query history is only available if JavaScript is enabled in your - browser. + The query history is only available if JavaScript is enabled in your + browser.

      To allow the usage of this functionality: @@ -1003,6 +1003,15 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'; effect when PHP is running in safe mode. +
      $cfg[MemoryLimit] integer [number of bytes]
      +
      + Set the number of bytes a script is allowed to allocate. If number set + to zero, no limit is imposed.
      + This setting is used while importing/exporting dump files but has no + effect when PHP is running in safe mode.
      + You can also use any string as in php.ini, eg. '16M'. +
      +
      $cfg[SkipLockedTables] boolean
      Mark used tables and make it possible to show databases with locked @@ -1705,14 +1714,14 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'; changes to display a query box.

      The size of this query window can be customized with - $cfg['QueryWindowWidth'] and $cfg['QueryWindowWidth'] - - both integers for the size in pixels. Note that normally, those - parameters will be modified in layout.inc.php for the - theme you are using. + $cfg['QueryWindowWidth'] and $cfg['QueryWindowWidth'] + - both integers for the size in pixels. Note that normally, those + parameters will be modified in layout.inc.php for the + theme you are using.

      - If $cfg['EditInWindow'] is set to true, a click on [Edit] - from the results page (in the "Showing Rows" section) - opens the query window and puts the current query + If $cfg['EditInWindow'] is set to true, a click on [Edit] + from the results page (in the "Showing Rows" section) + opens the query window and puts the current query inside it. If set to false, clicking on the link puts the SQL query in the right panel's query box.

      @@ -2976,11 +2985,11 @@ RewriteRule ^([a-zA-Z0-9_]+)$ index.php?db=$1 [R] set to the default (200) or another low value, you could get this error if your table has a high number of columns. Adjust this setting accordingly. (Thanks to Klaus Dorninger for the hint). -
    • -
    • - In the php.ini directive arg_separator.input, a value +
    • +
    • + In the php.ini directive arg_separator.input, a value of ";" will cause this error. Replace it with "&;". -
    • +

    diff --git a/export.php b/export.php index 6c48e006e..0bc0ad0de 100644 --- a/export.php +++ b/export.php @@ -35,6 +35,9 @@ if ($export_type == 'server') { * Increase time limit for script execution and initializes some variables */ @set_time_limit($cfg['ExecTimeLimit']); +if (!empty($cfg['MemoryLimit'])) { + @ini_set('memory_limit', $cfg['MemoryLimit']); +} // Start with empty buffer $dump_buffer = ''; diff --git a/import.php b/import.php index 11a94f2f4..ad9a86ad9 100644 --- a/import.php +++ b/import.php @@ -91,6 +91,10 @@ if (isset($db)) { } @set_time_limit($cfg['ExecTimeLimit']); +if (!empty($cfg['MemoryLimit'])) { + @ini_set('memory_limit', $cfg['MemoryLimit']); +} + $timestamp = time(); if (isset($allow_interrupt)) { $maximum_time = ini_get('max_execution_time'); diff --git a/libraries/config.default.php b/libraries/config.default.php index c7a9976f3..17cb6ae27 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -126,6 +126,7 @@ $cfg['OBGzip'] = 'auto'; // use GZIP output buffering if possib $cfg['PersistentConnections'] = FALSE; // use persistent connections to MySQL database $cfg['ForceSSL'] = FALSE; // whether to force using https $cfg['ExecTimeLimit'] = 300; // maximum execution time in seconds (0 for no limit) +$cfg['MemoryLimit'] = 0; // maximum alocated bytes (0 for no limit) $cfg['SkipLockedTables'] = FALSE; // mark used tables, make possible to show // locked tables (since MySQL 3.23.30) $cfg['ShowSQL'] = TRUE; // show SQL queries as run