I'm running into an issue trying to get codesniffer working with Xampp (1.7.1). I've got pear running by editing the include_path in php.ini.
When I try to run phpcs I get the following errors:
Warning: include_once(PHP/CodeSniffer/CLI.php): failed to open stream: No such file or directory in C:\xampp\php\phpcs on Line 31
Warning: include_once(): Failed opening 'PHP/Codesniffer/CLI.php' for inclusion (include_path="\xampp\php\pear") in C:\xampp\php\phpcs on line 31
Fatal error: Class 'PHP_CodeSniffer_CLI' not found in C:\xampp\php\phpcs on line 34
Anyone have any idea what's going on here?
It definitely sounds like the PHP include path is wrong, even though PEAR itself is working. It is a bit strange though.
Do you have a \xampp\php\pear\PHP\CodeSniffer\CLI.php file? If not, can you find where it is under the \xampp\php\pear directory?
If it is, for example, actually at \xampp\php\pear\source\pear\PHP\CodeSniffer\CLI.php then you'll need to change your include_path to be \xampp\php\pear\source\pear. But this could then break your PEAR install, which probably means PEAR is not configured correctly.
If this is the case, it's worth uninstalling PHP_CodeSniffer, changing the location of PEAR's php_dir configuration variable, and then reinstalling PHP_CodeSniffer.
For example:
pear uninstall php_codesniffer
pear config-set php_dir \xampp\php\pear
pear install php_codesniffer
(sorry, I'm not sure if pear on windows requires the drive letter in the path, so just check the current value using pear config-get php_dir and adjust the path based on that format.)
I hope that info helps you move forward a bit.
PEAR might have also setup an include path in the phpcs executable (-d include_path="''") which is overriding the default. This is particularly annoying if you forget to create a default php.ini file until after phpcs is installed.
Related
I am trying to install the YAML 1.2 extension to PHP 5.6 under IIS 10 (Windows 10). I am using http://pecl.php.net/package/yaml/1.2.0/windows to download the files.
I have downloaded the PHP 5.6 non-thread-safe DLL (x86 to match my version of PHP), copied php_yaml.dll to my extension directory, copied yaml.dll to C:\Windows\System32 (which is reported as one of the paths in phpinfo()) and added extension=php_yaml.dll to my php.ini. I've verified with phpinfo() that the correct php.ini file is being loaded, and commenting out other extensions removes them from the output of phpinfo().
However, YAML doesn't appear in the output of phpinfo() and the functions are not loaded. Running php-cgi.exe -v from the command line gives a warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\php_5_06_14\ext\php_yaml.dll' - The specified module could not be found.
in Unknown on line 0
The file exists at the location specified and the permissions appear to be correct. What else can I do to get it working?
As far as I can tell, the use of PECL as package manager is being in dropping.
Having to install extensions in a server makes things more complicated and it depends on the environment, permissions, etc.
I'm sure someone could help you solve that (I haven't work on windows in years, so I can't)
But, instead I suggest you another solution. Maybe you can opt for it, maybe you have to stick with the extension, but, in case you can actually look for other option, I suggest you to use another library.
https://github.com/symfony/yaml
And, you could use Composer to install your libraries, I suggest you take a look at it.
Again, it may be for you or not, but I think this would be a lot easier.
I hope that helps.
I put the path to my extension directory in the path environment variable. That fixed the issue for me.
My PHPStorm 7 installation is throwing this error whenever I try to add a box. Am I missing something?
I pointed to the vagrant.bat in installation directory as told here
Am I supposed to install ruby too? Didn't say something like that in vagrant's site though.
The path to the .bat file you are using (...\embedded\gems\...) suggests that it is ruby related .. and may require ruby for proper executing (the error message you see confirms such suggestion).
Instead, choose vagrant executable from C:\Program Files (x86)\HashiCorp\Vagrant\bin\ folder.
If .bat file is absent -- choose .exe one instead.
I am just getting start with Zend Framework and seem to run into this problem
Testing Note: PHPUnit was not found in your include_path, therefore no
testing actions will be created.
I am on mac 10.8.5, Using Zend Server 6 (free), and Zend Framework 1.12.3
Have pear and phpunit installed
which pear
/usr/local/zend/bin/pear
which phpunit
/usr/local/zend/bin/phpunit
from php info and include_path
Loaded Configuration File /usr/local/zend/etc/php.ini
include_path=".:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/bin/pear:/usr/local/zend/bin/phpunit:/usr/local/zend/share/pear:/usr/local/zend/share/pear/phpunit"
No matter what i put in the include_path, i always get the above notice, PHPUnit was not found in your include path.
I been searching and someone said zf.ini can cause this, and that file should be editted, however i can't seem to find such a file anywhere on my Mac. I do have previous Mamp and Xampp installations, but phpinfo() states the correct php.ini file loaded so i doubt that is the problem
Edit:
Okay so i finally managed to fix it. Using "zf.sh --setup" i found the paths to all the config files, including .zf.ini and how to edit it. The file did not exist, so i had to create it, and adding "include_path" to .zf.ini fixed the issue. However in the end i am overriding the php.ini which was probably being over ridden. I still like to know why adding pear path to php.ini didn't work, hopefully someone can explain that
I'v been trying to get phpunit up and running but for some reason i'm stuck with the following error:
Warning: require(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 44
Fatal error: require(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.:') in /usr/bin/phpunit on line 44
Does anybody have a clue how to solve this?
Thanks in advance!
Peter
Your include path is not setup. Follow the instructions at http://pear.php.net/manual/en/installation.checking.php
Also check if you installed phpunit in the correct directory:
$ pear list-files phpunit/phpunit
PHPUnit/Autoload.php should be listed there, in the patch you added to the include path.
Update: the problem was that #Peter had 2 php.ini files, and he edited the wrong one.
Find the correct one with
$ php --ini
Irakli's post was the most helpful.
I'm on Mac OS X 10.7.2 and I use Homebrew to install packages. Homebrew put php in /usr/local/bin/php.
Following Irakli's hint that phpunit is using a different version on of PHP (even though it was using the same php.ini file), I edited /usr/bin/phpunit, replacing this:
#!/usr/bin/php
with this:
#!/usr/local/bin/php
(Irakli's suggestion of "#!/usr/bin/env php" didn't work for me)
Now phpunit can find "File/Iterator/Autoload.php" which is was having trouble with before, so I guess it's in the path now.
On Mac Lion I added the include path:
/usr/lib/php/pear/
to /private/etc/php.ini which solved the error.
In some cases (e.g. when using brew-installed PHP on OS-X Leopard/Snow Leopard/Lion) the problem can be that there're multiple php versions installed and phpunit is picking wrong one.
There's an easy solution, sudo-edit /usr/bin/phpunit and replace #!/usr/bin/php with #!/usr/bin/env php
Somebody should probably submit a bug to phpunit, referring to PHP executable directly is really careless.
Im running xampp and i see the Pear folders in the php subdirectory. I have the html_quickform folder but i dont know where to place it?
Do i place it in the first Pear folders or the next Pear folders? I created a HTML folder on the first Pear folder to place it in but im getting this error:
**index.php**
require_once('HTML/QuickForm/QuickForm.php');
.
Warning: require_once(HTML/Common.php) [function.require-once]: failed to open stream: No such file or directory in C:\Users\Jonny\Desktop\projects\xampp\php\PEAR\HTML\QuickForm\QuickForm.php on line 33
Fatal error: require_once() [function.require]: Failed opening required 'HTML/Common.php' (include_path='C:\Users\Jonny\Desktop\projects\xampp\php\PEAR') in C:\Users\Jonny\Desktop\projects\xampp\php\PEAR\HTML\QuickForm\QuickForm.php on line 33
However the warning says i need html/common.php but there's no such thing in the Pear installation. THe only place i see common.php is in the second Pear folder but it is in the root not a HTML folder.
Judging from this question, you need to follow the instructions to install PEAR. And then you'll have a pear.bat which you need to run from the prompt.
In a nutshell:
c:\...\pear\go-pear.bat
It's better to use the installer to set it up:
pear(.bat) install html_quickform
(.bat if it's windows.)
It'll create the following structure:
C:\...\pear\HTML\QuickForm.php
C:\...\pear\HTML\QuickForm\...
etc. pp.
Doublecheck in your php.ini that C:\...\pear is in your include_path.
Then:
<?php
require_once 'HTML/QuickForm.php';
Thanks to Till's instructions i was able to do it(Windows)
For Windows users If you installed xampp under C:\,
Go to C:\xampp\php (type it on the command prompt, under this folder there is the pear.bat file)
Execute pear.bat by the following line pear.bat install html_quickform it will install the necessary folders
It will create the HTML folder that contains the QuickForm.php file .You can see it by checking under C:\xampp\php\PEAR\HTML
In the program you call it by simply doing:
require_once("HTML/QuickForm.php");
$form = new HTML_QuickForm(); // with form being the QuickForm() object.