pear PHPunit is not working with netbeans 7 - php

I have installed skeletongenerator and phpunit from pear and already pointed to batch file of them in netbeans settings. but if i try to create phpunit test it shows following error. it seems like it can't find certain file. but when i installed it was being installed fine. how to fix it so that phpunit can be use with netbeans php?
PHP Warning: require_once(ezc/Base/base.php): failed to open stream:
No such file or directory in
E:\wamp\bin\php\php5.4.3\pear\SebastianBergmann\PHPUnit\SkeletonGenerator\autoload.php
on line 49 PHP Stack trace: PHP 1. {main}()
E:\wamp\bin\php\php5.4.3\phpunit-skelgen:0 PHP 2. require()
E:\wamp\bin\php\php5.4.3\phpunit-skelgen:41 PHP Fatal error:
require_once(): Failed opening required 'ezc/Base/base.php'
(include_path='.;E:\wamp\bin\php\php5.4.3\pear') in
E:\wamp\bin\php\php5.4.3\pear\SebastianBergmann\PHPUnit\SkeletonGenerator\autoload.php
on line 49 PHP Stack trace: PHP 1. {main}()
E:\wamp\bin\php\php5.4.3\phpunit-skelgen:0 PHP 2. require()
E:\wamp\bin\php\php5.4.3\phpunit-skelgen:41

It seems that your code depends on or uses the EZ components.
You need to install the ezComponents via PEAR, too.

Related

Symfony 3.0 installation

Am new to symfony and from last month am continuously installing new symfony project using following command on ubuntu from the terminal
# Linux, Mac OS X
$ symfony new my_project_name
and it was working perfectly until today, but than just checked the new version release, but now it started giving me following error
Downloading Symfony...
4.93 MB/4.93 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
Preparing project...
PHP Warning: require(/var/www/projectname/app/SymfonyRequirements.php): failed to open stream: No such file or directory in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
PHP Fatal error: require(): Failed opening required '/var/www/projectname/app/SymfonyRequirements.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
I have even check the symfony at location usr/local/bin/symfony and it was there.
It is a resolved issue that you need to specify the version you want to install. As described here and here, you need to:
Update your installer
>symfony self-update
or with sudo, depending on how you install it:
>sudo symfony self-update
Specify the version:
>symfony new my_project_name 3.0
Hope this helps.
UPDATE
With the correct resolutions of the bug on the Symfony installer, now the 3.0 is the default version. In other case, you can specify the complete version (with minor and major) as follows:
>symfony new my_project_name 3.0.0

CakePHP 3 Composer Installation Error

I am trying to create a project as shown in the official Bookmarker Tutorial using the following command:
composer create-project --prefer-dist cakephp/app bookmarker
Then I see the following errors:
[RuntimeException]
Could not load package cakephp/migrations in http://packagist.org:
[UnexpectedValueException] Could not parse version constraint >=0.4.2
<1.0: Invalid version string "0.4.2 <1.0"
[UnexpectedValueException]
Could not parse version constraint >=0.4.2 <1.0: Invalid version
string "0.4.2 <1.0"
Then I run bin/cake server and see the following errors:
PHP Warning:
require(/Library/WebServer/Documents/bookmarker/vendor/autoload.php):
failed to open stream: No such file or directory in
/Library/WebServer/Documents/bookmarker/config/bootstrap.php on line
23 PHP Stack trace: PHP 1. {main}()
/Library/WebServer/Documents/bookmarker/bin/cake.php:0 PHP 2.
include() /Library/WebServer/Documents/bookmarker/bin/cake.php:31
Warning:
require(/Library/WebServer/Documents/bookmarker/vendor/autoload.php):
failed to open stream: No such file or directory in
/Library/WebServer/Documents/bookmarker/config/bootstrap.php on line
23
Call Stack:
0.0010 227136 1. {main}() /Library/WebServer/Documents/bookmarker/bin/cake.php:0
0.0021 237624 2. include('/Library/WebServer/Documents/bookmarker/config/bootstrap.php')
/Library/WebServer/Documents/bookmarker/bin/cake.php:31
PHP Fatal error: require(): Failed opening required
'/Library/WebServer/Documents/bookmarker/vendor/autoload.php'
(include_path='.:/usr/local/Cellar/php55/5.5.21/lib/php') in
/Library/WebServer/Documents/bookmarker/config/bootstrap.php on line
23 PHP Stack trace: PHP 1. {main}()
/Library/WebServer/Documents/bookmarker/bin/cake.php:0 PHP 2.
include() /Library/WebServer/Documents/bookmarker/bin/cake.php:31
Fatal error: require(): Failed opening required
'/Library/WebServer/Documents/bookmarker/vendor/autoload.php'
(include_path='.:/usr/local/Cellar/php55/5.5.21/lib/php') in
/Library/WebServer/Documents/bookmarker/config/bootstrap.php on line
23
Call Stack:
0.0010 227136 1. {main}() /Library/WebServer/Documents/bookmarker/bin/cake.php:0
0.0021 237624 2. include('/Library/WebServer/Documents/bookmarker/config/bootstrap.php')
/Library/WebServer/Documents/bookmarker/bin/cake.php:31
My system is OS X Yosemite 10.10.2, my PHP version is 5.5.21 and intl extension is enabled.
Are there anyone who had this issue or similar? Any solutions?
Run following command first (you might need to prepend this with sudo if composer was installed globally)
composer self-update
then again
composer create-project --prefer-dist cakephp/app bookmarker
The latest way to install CakePHP 3.2 is:
curl -s https://getcomposer.org/installer | php
php composer.phar create-project --prefer-dist cakephp/app bookmarker
First find out which version of PHP you are using, and find out where it is located.
> php -v
PHP 5.5.34 (cli) (built: Apr 22 2016 19:16:58)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
> which php
/usr/bin/php
You need to have php version 7 as the primary one. I know of two options for you.
Copy the MAMP php file over to replace your /usr/bin/php file (you may also want to back it up.
(sudo mv /usr/bin/php /usr/bin/php5.5.34; sudo cp /Applications/MAMP/bin/php/php7.0.0/bin /usr/bin/php)
Order your system $PATH variable to the MAMP path for your php7 bin directory. You can also add this line to your ~/.profile so it will load every time you start the terminal.
export PATH="/Applications/MAMP/bin/php/php7.0.0/bin:$PATH";
Once these changes are made, you should be able to install cake without a problem, and your cake bake commands should also work.
if you go into your app folder and run
composer install
it might fix it.
If fix it for me!
Thanks

why aws.phar runs once then won't load again?

I install aws sdk for php in my elastic beanstalk application using phar file,:
require_once __DIR__ . '/../AWS-SDK/aws.phar';
when I run the script for the first time, it succeed ! but when I try again I got this error :
Warning: require(phar://aws.phar/aws-autoloader.php): failed to open stream: phar error: invalid url or non-existent phar "phar://aws.phar/aws-autoloader.php" in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3 Fatal error: require(): Failed opening required 'phar://aws.phar/aws-autoloader.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3
How to solve the problem ?
Don't use require_once. That's causing that issue. You should use require or include
There seems to be an error on some versions of the aws.phar file that causes this behavior and warning message.
Warning: require(phar://aws.phar/aws-autoloader.php): failed to open stream: phar error: invalid url or non-existent phar "phar://aws.phar/aws-autoloader.php" in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3 Fatal error: require(): Failed opening required 'phar://aws.phar/aws-autoloader.php' (include_path='.:/usr/share/pear:/usr/share/php')
I was experimenting the same issue using aws.phar with version 2.7.17 of the AWS SDK for PHP
The solution that worked for me was to download and extract the aws.zip version of the AWS SDK for PHP and require aws-autoloader.php instead as described in the installation docs.
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html#installing-via-zip
Some people reports success when using the 2.4.10 version of the AWS (aws.phar) but that is too old for my purposes.
https://pyd.io/f/topic/pydio-6-0-s3-plugin-phar-error/
Try turning off opcache
add the following to /etc/php5/apache2/php.ini opcache.enable=0
restart apache service apache2 restart
This is a know issue at least with older versions of the aws.phar and there seems to be a general issue with phars and opc (formerly Zend Optimizer+)
to solve the problem I'v installed the sdk using composer ! BTW it's the recommended technique !
Make sure you declare all namespace usage at the top of the file before you do "require". If you include files first, it can mess up the namespacing. This fixed the issue for me.

installation of vfsstream using pear

I need to setup vfsStream to use it with PHPUnit on my env. Unfortunately the project is very old and I cannot use composer. Instead I tried to install it using pear acording to documentation. Bovigo channel is discovered properly but when I try to install vfs I get following stack trace:
[vagrant#dev site]$ pear install bovigo/vfsStream-beta
Warning: lstat(): Lstat failed for /var/cache/php-pear/ea87df910d5f186e8b68f01fb94241bcrest.cacheid in PEAR/REST.php on line 276
PHP Warning: lstat(): Lstat failed for /var/cache/php-pear/ea87df910d5f186e8b68f01fb94241bcrest.cacheid in /usr/share/pear/PEAR/REST.php on line 276
PHP Stack trace:
PHP 1. {main}() /usr/share/pear/pearcmd.php:0
PHP 2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
PHP 3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
PHP 4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
PHP 5. PEAR_Downloader_Package->initialize() /usr/share/pear/PEAR/Downloader.php:279
PHP 6. PEAR_Downloader_Package->_fromString() /usr/share/pear/PEAR/Downloader/Package.php:190
PHP 7. PEAR_Downloader->_getPackageDownloadUrl() /usr/share/pear/PEAR/Downloader/Package.php:1713
PHP 8. PEAR_REST_13->getDownloadURL() /usr/share/pear/PEAR/Downloader.php:850
PHP 9. PEAR_REST->retrieveData() /usr/share/pear/PEAR/REST/13.php:68
PHP 10. PEAR_REST->saveCache() /usr/share/pear/PEAR/REST.php:163
PHP 11. PEAR_REST->saveCacheFile() /usr/share/pear/PEAR/REST.php:246
PHP 12. lstat() /usr/share/pear/PEAR/REST.php:276
No releases available for package "pear.bovigo.org/vfsStream"
install failed
It looks like you might need to do that via sudo, e.g.
$ sudo pear ....

PHPUnit doesn't work in Fedora 16

Recently I upgrade my machine to fedora 16. PHPUnit worked fine on fedora 15. But after upgrade , when I run tests , it gives
PHP Warning: require_once(PHPUnit/Framework.php): failed to open stream: No such file or directory in "PATH TO MY TEST CLASSS".php on line 19
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP 6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP 8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP 9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95
PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Framework.php' (include_path='.:/usr/share/pear:/usr/share/php') in "PATH TO MY TEST CLASS".php on line 19
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP 6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP 8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP 9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95
What can be the issue for this. ? Any Help ..?
I'd assume you are installing PHPUnit through the fedora package manager? That would be the only reason why the os version would have any impact on that :)
In both cases your problem seems to be that you are running PHPUnit 3.6.x and your code base seems not be fit for this version and requires you to downgrade to PHPUnit 3.5.15
You can do this using the pear installer (instead of installing phpunit from packages) so remove the package and follow the relevant part of:
Downgrading phpunit 3.6 to 3.5.15
In general it is not needed to require that file anymore. The phpunit runner will that up everything and in case you are using some custom runner only PHPUnit/Autoload.php is needed.
The current way structuring phpunit test suites (recommended since 3.4.) is described here: PHPUnit manual: Organizing tests

Categories