title: How to use PHP in a Phing build file correctly?
body: <p>I am writing PHP directly inside a Phing <em>build.xml</em> file using <code>adhoc-task</code>.</p>
  
  <p>The following does work but throws up console errors:</p>
  
  <pre><code>&lt;adhoc-task name="foo"&gt;&lt;![CDATA[
  
   define('WP_INSTALLING', true);
  
   require_once '${build.dir.wp}/wp-load.php';
   require_once '${build.dir.wp}/wp-admin/includes/upgrade.php';
   require_once '${build.dir.wp}/wp-includes/wp-db.php';
  
   $result = wp_install( 'title', 'admin', 'admin@example.com');
  
  ]]&gt;&lt;/adhoc-task&gt;
  </code></pre>
  
  <p><em>The error: The adhoc class you defined must be an instance of phing.Task BUILD FAILED.The adhoc class you defined must be an instance of phing.Task</em></p>
  
  <p>But it still works...</p>
  
  <p>If I wrap the PHP in a class it doesn't work at all:</p>
  
  <pre><code>&lt;adhoc-task name="foo"&gt;&lt;![CDATA[
  
     class FooTest extends Task {
     //php code ....
     }
  ]]&gt;&lt;/adhoc-task&gt;
  </code></pre>
  
  <p><em>The error: You must define at least one class for AdhocTaskdefTask.</em></p>
  
  <p>What is the proper way to include PHP inside the build file (without having access to the php/phing/tasks folder)?</p>