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 7984985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:26:40+00:00 2026-06-04T11:26:40+00:00

In a Phing build file, I would like to invoke an external program (

  • 0

In a Phing build file, I would like to invoke an external program (lessc in this case), but the program might live in a different location depending on which system the script is run on.

This is what I am doing currently. It works, but it smells to me:

<property name="lessc" value="/usr/bin/lessc" override="true" />

<if>
  <not>
    <available file="${lessc}" />
  </not>
  <then>
    <fail msg="Could not find LESS compiler at ${lessc}." />
  </then>
</if>

<exec command="${lessc} ..." />

I am using a property so that the user can specify an alternate path to lessc for her system, but I would prefer it if the script could automatically determine the location of the executable via e.g. hash or which.

Is this possible to do in Phing?

  • 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-04T11:26:41+00:00Added an answer on June 4, 2026 at 11:26 am

    I came across Use `env` on Sean Coates’s blog the other day, which deals with a very similar problem; in his case he found that PHP scripts were failing when run via CLI on different systems because PHP was installed in different locations.

    His solution was to replace the #!/path/to/php header with #!/usr/bin/env php. Since env is (probably) always located at /usr/bin/env, the only configuration required is to ensure that the PHP binary is on the $PATH for whatever user is executing the CLI script. No server-specific code changes necessary!

    Well, this got me thinking.

    I changed my build file to look like this, and everything is working beautifully now:

    <property name="env" value="/usr/bin/env" override="true" />
    
    <if>
      <not>
        <available file="${env}" />
      </not>
      <then>
        <fail msg="Unable to locate env executable at ${env}." />
      </then>
    </if>
    
    <exec command="${env} lessc ..." />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Phing to create build files, but I've noticed that it does not
I am having problems with malformed XML in my phing build file. I want
I would like to do remote deployment from my build machine onto a server.
I'm creating build file for phing. The problem is that it must move a
I'd like to build an infrastructure that will monitor a server and check ping,
I'm using Phing to do post build tasks in Hudson. I want to generate
I tried different phing filters regex aso. to cut out different pieces of code
General Info: PHP 5.3.3 PHPUnit 3.4 Zend Framework 1.10.8 Phing build target <target name=test>
I'm triyng to create a generic phing script that will build a joomla plugin.
I am new to phing and trying to verify if my build.xml works as

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.