Mochabomb

Web Design and Technical notes

Mochabomb header image 2

Run shell_exec in Wordpress and Drupal

March 5th, 2007 2:49 am · No Comments

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
?>
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Tags: Drupal · PHP · Wordpress

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment