Run PHP script from bash

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alvaro G Vicario

    Run PHP script from bash

    I'm trying to run a PHP file as a shell script (with the regular
    /usr/bin/php interpreter). It looks like this:

    #!/usr/bin/php -q -d html_errors=0
    <? echo "This is a test\n"; ?>

    This is the result of the execution:

    $ ./cibervivienda.p hp
    Error in argument 1, char 3: option not found
    Error in argument 1, char 4: option not found -
    Error in argument 1, char 3: option not found

    I can solve it removing the "-d html_errors=0" part but then I get
    HTML-formated errors. I can't find the logic because the option is
    definitively accepted if I type it myself:

    $ /usr/bin/php -q -d html_errors=0
    <? echo "This is a test\n"; ?>
    This is a test

    I'm not sure whether it's a PHP or a bash issue. Thank you in advance,


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Questions sent to my mailbox will be billed ;-)
    --
Working...