I have installed pear and php_beautifier with sudo...
From what I've read I should be able to format code with the command
php_beautifier x.php
But when I try to do this I get this error:
Warning: require_once(PEAR.php): failed to open stream: No such file or directory in /Users/philip/pear/bin/php_beautifier on line 37
Fatal error: require_once(): Failed opening required 'PEAR.php' (include_path='.:') in /Users/philip/pear/bin/php_beautifier on line 37
I have looked at the php_beautifier.php code and I don't know what's wrong. Line 37:
require_once 'PEAR.php';
and the file is in the same dir as pear.php?
Ideally, the path to PEAR directory should be specified in include_path
directive in php.ini. This allows you to include PEAR core and packages in your code easily, for example:
require_once 'PEAR.php';
require_once 'Console/Getopt.php';
Otherwise, you will have to specify full path to the PEAR directory which makes your code less portable:
require_once '/usr/share/pear/PEAR.php';
require_once '/usr/share/pear/Console/Getopt.php';
To probe the effective value of the include_path
directive, use the phpinfo()
function. If it does not contain the path to PEAR installation, use:
# UNIX
include_path = ".:/path/to/pear"
# Windows
include_path = ".;C:\path\to\pear"
More detailed and step-by-step instructions can be found here.