Search code examples
ubuntuphppear

Pear PHP_Beautifier returning no output


I intend to use PHP_Beautifier in a code evaluation tool I'm working on but I can't get it working on Ubuntu 11.10. I installed it on my local server trough pear php package manager with the following command:

sudo pear install --alldeps PHP_Beautifier-0.1.15

But when I try to invoke the php_beautifier on my application it returns no output, and when I execute php_beautifier on the terminal the following message is given:

$ php_beautifier -f sample.php -o sample.php
>
Jan 06 19:06:21 php_beautifier [error] Nothing on output!
PHP Notice:  Undefined index: file in /usr/bin/php_beautifier on line 225
PHP Notice:  Undefined index: line in /usr/bin/php_beautifier on line 225

Any help on how to get PHP_Beautifier to work on Ubuntu 11.10?


Solution

  • I found the problem. It seems php_beautifier is not able to use the same file as the input (-f) and output (-o), so I just had to use something like this:

    $ php_beautifier -f ugly.php -o beautiful.php
    

    Or suppress the output argument like this, and catch the output returned:

    $ php_beautifier -f ugly.php