php codesniffer + xampp: Missing PEAR/Exception.php - php

I followed exactly what's in: How to use PHP_CodeSniffer with XAMPP? (no more no less)
But i encounter this error:
Warning: require_once(PEAR/Exception.php): failed to open stream: No such file or directory in C:\path\to\htdocs\php-codesniffer\CodeSniffer\Exception.php on line 17

Found out what's wrong. PEAR is not initially enabled in xampp.
include_path = ".;C:\Documents\xampp\php\PEAR"
Also consider this if your changing the include_path value in your php scripts via ini_set.

Related

phpdoc on Netbeans using MAMP not working

I am trying to get phpdoc working on netbeans but I am getting the following error
PHP Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /Applications/MAMP/bin/php/php5.4.4/bin/phpdoc on line 40
PHP Fatal error: require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:') in /Applications/MAMP/bin/php/php5.4.4/bin/phpdoc on line 40
When I run
pear config-show in the Terminal I get the following php_dir path
/Applications/MAMP/bin/php/php5.4.4/lib/php
I have checked that the php.ini file exits and it does under
/Applications/MAMP/bin/php/php5.4.4/lib/php/phpDocumentor/phpDocumentor/phpdoc.ini
Does anyone know what the problem can be or how to resolve it. I want to use the phpdoc using Netbeans and not have to revert to the Terminal every time I want to update my documentation.
You need to edit include_path in php.ini to add PEAR's php_dir value to it. Notice in the error message that your include_path is set to nothing but ".". As such, the only place PHP is looking for PhpDocumentor/phpDocumentor/phpdoc.inc is right there in your /Applications/MAMP/bin/php/php5.4.4/bin directory. Once you add /Applications/MAMP/bin/php/php5.4.4/lib/php to your include_path, then PHP will be able to find the phpdoc.inc file at runtime.

Pear Packages not working

I've been trying to use a few PEAR packages for a few hours now to no avail. PEAR itself is functioning, and I believe I set all of the configuration variables correctly, but when I try to run any of my packages from the command line, I get PHP errors telling me the required file wasn't found. For example, with phpdoc:
$ phpdoc
PHP Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40
Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40
PHP Fatal error: require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/Applications/MAMP/bin/php5.2/lib/php') in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40
Fatal error: require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/Applications/MAMP/bin/php5.2/lib/php') in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40
I tried manually editing the files, inserting the absolute path to the files, but when I correct one require error a new one just comes up.
This is my pear.conf:
#PEAR_Config 0.9
a:15:{s:10:"__channels";a:2:{s:12:"pecl.php.net";a:0:{}s:5:"__uri";a:0:{}}s:15:"preferred_state";s:6:"stable";s:8:"temp_dir";s:35:"/Applications/MAMP/htdocs/pear/temp";s:7:"bin_dir";s:34:"/Applications/MAMP/htdocs/pear/bin";s:7:"php_dir";s:35:"/Applications/MAMP/htdocs/pear/PEAR";s:7:"doc_dir";s:40:"/Applications/MAMP/htdocs/pear/PEAR/docs";s:8:"data_dir";s:40:"/Applications/MAMP/htdocs/pear/PEAR/data";s:8:"test_dir";s:41:"/Applications/MAMP/htdocs/pear/PEAR/tests";s:9:"cache_dir";s:41:"/Applications/MAMP/htdocs/pear/PEAR/cache";s:9:"cache_ttl";i:300;s:12:"download_dir";s:44:"/Applications/MAMP/htdocs/pear/temp/download";s:10:"http_proxy";s:0:"";s:7:"ext_dir";s:74:"/Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20050922";s:7:"php_bin";s:37:"/Applications/MAMP/bin/php5.2/bin/php";s:10:"sig_keydir";s:39:"/Applications/MAMP/conf/php5.2/pearkeys";}
I'm using MAMP PRO v1.9.5 on Mac OS 10.7.5 with PHP v5.2.17. Also, I installed the packages with the PEAR web interface package manager. If any further information is required, please let me know and I'll post it.
Make sure that the include path contains the folder where PEAR installs php class files. Check your include_path ini setting. It should look like:
include_path=".:PEAR_CLASSES_PATH"
where PEAR_CLASSES_PATH is the pear class path

pear include_path data folder is no longer valid

I have a vps with centOS LAMP stack, and multiple domains/ips. A long time ago I had someone more familiar with SSH install pear on the vps, and I believe he configured it for a specific user/domain, which no longer exists, and now pear is throwing errors.
The old user/domain which no longer exists is "ljsspin" but when I look at my php.ini, the include path is:
include_path = ".:/usr/share/pear/:/usr/share/php:/var/www/ljsspin/data/pear/:"
I can execute pear commands in ssh, but I'm assuming the fact that the last portion of that include path no longer exists is the reason for the error.
So my question is how do I install the necessary /data/pear files into a new directory? I've tried upgrading pear, and that, too, produced an error (unable to unpackage a structure file).
Thanks for any guidance.
Exact error message I receive:
Warning: include() [function.include]: open_basedir restriction in effect. File(/usr/share/pear/Mail.php) is not within the allowed path(s): (/var/www/steve/data:.) in /var/www/steve/data/www/newdomain.com/admin/dashboard/includes/pdf.php on line 3
Warning: include(/usr/share/pear/Mail.php) [function.include]: failed to open stream: Operation not permitted in /var/www/steve/data/www/newdomain.com/admin/dashboard/includes/pdf.php on line 3
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.:/usr/share/pear/:/usr/share/php:/var/www/ljsspin/data/pear/:') in /var/www/steve/data/www/newdomain.com/admin/dashboard/includes/pdf.php on line 3
The open_basedir restriction in effect error message means that you've set a value for the open_basedir PHP directive so scripts are not allowed to read files from outside a given set of directories, which in your case are these:
/var/www/steve/data
.
Since PEAR packages are installed in some other directory:
/usr/share/pear/
... PHP prevents scripts from reading them, as it's been instructed to do.
If you intend to allow access to /usr/share/pear/, you'll obviously have to broaden the restriction.

Why won't PEAR work on my PHP Windows installation?

I'm running Wampserver on Windows 7, and I can't seem to get PEAR to work. Well, that's
not entirely true-apparently it works on the command line (both cmd.exe and on Cygwin).
Here's the sample program I found on PHP.Net that shows you if PEAR is installed:
<?PHP
require_once 'System.php';
var_dump(class_exists('System', false));
?>
On the command line, it returns "bool(true)", and in the browser I get
Warning: require_once(System.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\foobar.php on line 3
Fatal error: require_once() [function.require]: Failed opening required 'System.php' (include_path='.;C:\php\pear') in C:\wamp\www\foobar.php on line 3
I'm honestly not sure what I'm doing wrong. It seems like both should work, but I'm stumped.
Thanks.
Looks like your apache (or other webserver) is picking up wrong php.ini.
Make a page with a call to phpinfo()
Load the page in browser
Check the PHP.ini path its using.
Copy your proper php.ini to that location.
Based on your comments, it looks like your include_path is wrong. Go change your PHP.ini and set your include path to:
include_path = ".;C:\wamp\bin\php\php5.3.10\pear"

Pear installed, but php includes provides errors

I just leased a dedicated windows server with Plesk 10.4 installed. I assumed that php, etc would all be configured and that I could prot my sites over with no isses...
Turns out the default image didn't have pear installed...I believe i need pear so include statements work in php...so I used go-pear.bat to install it...
However, I'm still getting an error when including (you can follow the path to see the file exists)
Warning: include(Connections/SamConnection.php) [function.include]: failed to open stream: Operation not permitted in C:\Inetpub\vhosts\80stunes.com\httpdocs\index.php on line 3
Warning: include() [function.include]: Failed opening 'Connections/SamConnection.php' for inclusion (include_path='.;C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\PEAR;C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5;./includes;./pear') in C:\Inetpub\vhosts\80stunes.com\httpdocs\index.php on line 3
Any ideas on what I have done wrong? I can run pear commands from a command prompt when accessing my pleskphp5 directory
Sounds like you may have open_basedir enabled.

Categories