phpscriptingphing

running a php script inside phing


I am trying to use phing to automate some of the processes I do at work. Currently, I am trying to run a php script I have, but nothing is output to the screen when I run phing. Here is my build.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<project name="projectName" basedir="." default="release">
    <target name="release">
        <exec command="php path/to/script/script.php hi" escape="false"/>
    </target>
</project>

and here is what script.php is currently doing:

<?php

print_r($argv);

when I run phing, I expect it to print the command line arguments (just a test to make sure things are working properly), but instead I don't get anything output to the screen. Am I doing something wring with this? I am using php 7.1.4 and phing 2.16.0


Solution

  • You forgot the passthru attribute, so you can see the output of your script

    Try this:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <project name="projectName" basedir="." default="release">
        <target name="release">
            <exec command="php path/to/script/script.php hi" escape="false"  passthru="true" />
        </target>
    </project>