Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:38:32+00:00 2026-06-11T11:38:32+00:00

I am writing PHP directly inside a Phing build.xml file using adhoc-task . The

  • 0

I am writing PHP directly inside a Phing build.xml file using adhoc-task.

The following does work but throws up console errors:

<adhoc-task name="foo"><![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');

]]></adhoc-task>

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

But it still works…

If I wrap the PHP in a class it doesn’t work at all:

<adhoc-task name="foo"><![CDATA[

   class FooTest extends Task {
   //php code ....
   }
]]></adhoc-task>

The error: You must define at least one class for AdhocTaskdefTask.

What is the proper way to include PHP inside the build file (without having access to the php/phing/tasks folder)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:38:33+00:00Added an answer on June 11, 2026 at 11:38 am

    From test/etc/regression/299/build.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <project name="test" default="main">
    
      <target name="main">
        <bar/>
      </target>
    
      <adhoc-task name="bar"><![CDATA[
          class BarTask extends Task {
              function main() {
                  print("BarTask: success!\n");
              }
          }
      ]]></adhoc-task>
    
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a PHP wrapper for a C++ library using SWIG, but I
Initially I had the habbit of directly writing the php code in the <?php
I'm writing some functions in php using exec() to interrogate a svn. The commands
Im using sessions for login systems in PHP. In all login examples, people directly
I am writing firefox extension with following install.rdf <?xml version=1.0?> <!--Copyright 2011, Example -->
I'm writing my first PHP app that has to directly deal with dates, and
I have a scenario where one PHP process is writing a file about 3
When writing PHP code for any given project, do you find you can write
Often when writing PHP I'll have it output some HTML like this - echo
I writing a PHP script program under Linux. In the script, I need call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.