Archive for the ‘PHP’ Category

PHP memory limit results in blank pages

November 5th, 2007

From a Drupal install, got a blank page when logging in….

[Mon Nov 05 13:20:36 2007] [error] [client 71.139.36.123] PHP Fatal error:
Allowed memory size of 16777216 bytes exhausted (tried to allocate 92160 bytes) in
/home/someuser/public_html/modules/event/event_timezones.inc on line 331, referer: http://example.com/

Up the memory in php.ini a few MB, restart httpd and all was working..

  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Run shell_exec in WordPress and Drupal

March 5th, 2007

I found this out on accident – use nested includes to use shell_exec in WordPress and Drupal posts without any issues – I am using the Exec-PHP plugin.

* Tested with WordPress 2.1.2
* WordPress: Only works in Blog posts – not in a “page” – the PHP will not work.
* WordPress: Must use file path, not HTTP URL – see example below. URL’s will not work for the post.
* Drupal, tested as pages – works fine.

WordPress / Drupal Post text – use includes only:

<?php
include "/home/user/domain.com/ScriptDir/index.php";
?>

Contents of /home/user/domain.com/ScriptDir/index.php

<?php
include "/home/user/domain.com/ScriptDir/foo.php";
?>

Finally, the contents of /home/user/domain.com/ScriptDir/foo.php

<?php
shell_exec ( unix commands );
.. more verboten commands
?>
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Mochabomb is Digg proof thanks to caching by WP Super Cache