Skip to content

Commit

Permalink
Configurable memory limit (RFE #1373904).
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Dec 16, 2005
1 parent fc27033 commit 8c6b399
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -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 <cybot_tm@users.sourceforge.net>
* libraries/Config.class.php:
Expand Down
39 changes: 24 additions & 15 deletions Documentation.html
Expand Up @@ -66,7 +66,7 @@ <h2>Requirements</h2>
<li>
<b>PHP</b>
<ul>
<li>You need PHP 4.1.0 or newer, with <tt>session</tt> support (<a href="#faq1_31">*</a>)</li>
<li>You need PHP 4.1.0 or newer, with <tt>session</tt> support (<a href="#faq1_31">*</a>)</li>
<li>If you want to display inline thumbnails of JPEGs with the
original aspect ratio, you also need GD2 support in PHP</li>
<li>Starting with phpMyAdmin 2.6.1, MIME-based transformations
Expand Down Expand Up @@ -343,7 +343,7 @@ <h3>Using authentication modes</h3>

GRANT SELECT, INSERT, UPDATE, DELETE ON &lt;pma_db&gt;.* TO 'pma'@'localhost';
</pre>
(this of course requires that your <a href="#linked-tables">linked-tables infrastructure</a> be set up).
(this of course requires that your <a href="#linked-tables">linked-tables infrastructure</a> be set up).
<br />
Of course, the above queries only work if your MySQL version supports
the GRANT command. This is the case since 3.22.11.
Expand Down Expand Up @@ -864,8 +864,8 @@ <h2>Configuration</h2>
you want to have on hold. On every login, this list gets cut to the maximum amount.
<br /><br />

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.
<br /><br />

To allow the usage of this functionality:
Expand Down Expand Up @@ -1003,6 +1003,15 @@ <h2>Configuration</h2>
effect when PHP is running in safe mode.
</dd>

<dt><b><a name="cfg_MemoryLimit"></a>$cfg[MemoryLimit] </b>integer [number of bytes]</dt>
<dd>
Set the number of bytes a script is allowed to allocate. If number set
to zero, no limit is imposed.<br />
This setting is used while importing/exporting dump files but has no
effect when PHP is running in safe mode.<br />
You can also use any string as in php.ini, eg. '16M'.
</dd>

<dt><b><a name="cfg_SkipLockedTables"></a>$cfg[SkipLockedTables] </b>boolean</dt>
<dd>
Mark used tables and make it possible to show databases with locked
Expand Down Expand Up @@ -1705,14 +1714,14 @@ <h2>Configuration</h2>
changes to display a query box.
<br /><br />
The size of this query window can be customized with
<tt>$cfg['QueryWindowWidth']</tt> and <tt>$cfg['QueryWindowWidth']</tt>
- both integers for the size in pixels. Note that normally, those
parameters will be modified in <tt>layout.inc.php</tt> for the
theme you are using.
<tt>$cfg['QueryWindowWidth']</tt> and <tt>$cfg['QueryWindowWidth']</tt>
- both integers for the size in pixels. Note that normally, those
parameters will be modified in <tt>layout.inc.php</tt> for the
theme you are using.
<br /><br />
If <tt>$cfg['EditInWindow']</tt> is set to true, a click on [Edit]
from the results page (in the &quot;Showing Rows&quot; section)
opens the query window and puts the current query
If <tt>$cfg['EditInWindow']</tt> is set to true, a click on [Edit]
from the results page (in the &quot;Showing Rows&quot; 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.
<br /><br />
Expand Down Expand Up @@ -2976,11 +2985,11 @@ <h4>
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).
</li>
<li>
In the <tt>php.ini</tt> directive <tt>arg_separator.input</tt>, a value
</li>
<li>
In the <tt>php.ini</tt> directive <tt>arg_separator.input</tt>, a value
of &quot;;&quot; will cause this error. Replace it with &quot;&amp;;&quot;.
</li>
</li>
</ul>

<a name="faqlimitations"></a><br />
Expand Down
3 changes: 3 additions & 0 deletions export.php
Expand Up @@ -35,6 +35,9 @@
* 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 = '';
Expand Down
4 changes: 4 additions & 0 deletions import.php
Expand Up @@ -91,6 +91,10 @@
}

@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');
Expand Down
1 change: 1 addition & 0 deletions libraries/config.default.php
Expand Up @@ -126,6 +126,7 @@
$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
Expand Down

0 comments on commit 8c6b399

Please sign in to comment.