Zend - cannot find PHPUnit/framework.php - php

I am running OSX Lion with an installation of XAMPP. Setting up PEAR with XAMPP has proven to be difficult, but I got it work and installed PHPUnit. When I look in the XAMPP pear directory I see a folder called 'PHPUnit', and when I look in that folder, I see the following files:
Assert.php
RepeatedTest.php
TestCase.php
TestFailure.php
TestResult.php
GUI
Skeleton.php
TestDecorator.php
TestListener.php
TestSuite.php
When I run zf create project myproject, I get the following message:
Warning: require_once(PHPUnit/Framework.php): failed to open stream: No such file or directory in /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/Test/PHPUnit/ControllerTestCase.php on line 29
I have no idea where to get this Framework.php file or how to fix this. Any help is appreciated.

Zend Framework requires you to run PHPUnit 3.5.x and I assume you have installed PHPUnit 3.6.x from pear.
Check out the guide on how to downgrade-phpunit-3-6-to-3-5-15 to fix your issue when running the ZF1 tests

Check your bootstrap.php and disable fallback autoloader:
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(false);

I also had to uninstall phing and replace it by an older version:
sudo pear uninstall phing/phing
sudo pear install phing/phing-2.3.3

Related

error using composer to install cakePHP 3

i am lost...
i am trying to do it the right way and am following the Quick Start Guide for installing cakePHP 3 on my ubuntu machine.
Got composer installed. Directory is /var/www/cakephp
and am trying to issue:
php composer.phar create-project --prefer-dist cakephp/app mayapp
or
composer create-project --prefer-dist cakephp/app may app
then i am simply getting:
[InvalidArgumentException]
Could not find package cakephp/app with stability stable.
i do not have a clue what i am doing wrong. Any suggestions?
cakephp/app exists on https://packagist.org, and the command looks ok to me.
Which PHP version are you using? That package is only available with PHP 5.4.16 or later, so you must update if you want to use CakePHP.
However, it is a good idea to only use the same PHP version of your public hosting, using a newer version will lead to problems when deploying your code. If your webspace or public server does not have the latest PHP 5.6 running, ask for an update.
I got same issue. But, as previous answer, myapp does not exists on packagist.org, so, you must use laravel/laravel instead, and, after created, rename the new laravel folder to your desired name and move to htdocs (for xampp) or www (for wamp), then, and I do not know why, go to : localhost/laravel/public/
and replace laravel with the name you gave to your project folder instead the laravel one.
You will see Laravel 5 fonts will appear on screen.
That's means Laravel is running.
Hey Please try these steps.
Download XAMPP Server.
Install XAMPP server.
Go to ..\xampp\php\php.ini and open.
Add this line (extension=php_intl.dll) or if exist uncomment.
Download Composer setup from https://github.com/composer/windows-setup/releases/
Install composer and give php.exe file in path
Open cmd and check now php version using command php -v. if its showing php version its means its working.
Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
Finished folder created in htdocs.
Hope this is helpful for you.

My Laravel installation error on localhost

I am new to Laravel, I have installed the Laravel on my localhost using
WAMP server but I am getting an error after all steps.
The errors are:
( ! ) Warning: require(C:\wamp\www\laravel/../bootstrap/autoload.php): failed to open stream: No such file or directory in C:\wamp\www\laravel\index.php on line 21
( ! ) Fatal error: require(): Failed opening required 'C:\wamp\www\laravel/../bootstrap/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\laravel\index.php on line 21
I have used below link for Laravel installation
http://www.wikihow.com/Install-Laravel-Framework-in-Windows
I have tried to debug the issue but haven't found success in the installation.
Please let me know what is missing in installation.
You need to install Composer, open up the command prompt and cd to your directory (or hold Shift while right-clicking on your directory and clicking Open command window here) and there run composer install.
You can simplify the Laravel installation with Composers create-project command.
composer create-project laravel/laravel path
Laravel dependencies are not installed yet. That is why it is giving you this error.
https://getcomposer.org/download/
Go to this link and download composer if you haven't already.
Move the composer file to /usr/bin and rename it to just composer.
Go into the root directory of your laravel application. And run:
composer update
This will install and update all required dependencies.
In case you are on windows, which is less likely, but if you are, just download and install composer via the installer and issue the same command in you project's root directory.
Composer is PHP's dependency manager.
In the root directory of your laravel installation you will find a composer.json file. It contains the list of all your project's dependencies. If you ever need to install a package in your project, it becomes very easy. You just have to edit the composer.json file and let it know which package you need. Issuing composer update will install new package listings and update all existing ones.
just to be clear I'm not big fan of wamp.
I've just took quick look at the
http://www.wikihow.com/Install-Laravel-Framework-in-Windows
and I suppose laravel framework is not going to work best with point 11 to 14 modifications.
Baseline for laravel to work is you need to http serve /public folder in a properly configured environment (after composer install and create-project as described earlier).
If you want to take full advantage of laravel you need to often cli `php or composer (at least)` efficiently.
While using laravel I suggest installing PHP and MYSQL yourself from scratch (it really takes few minutes) and using convenient IDE (like PHPSTORM for example).
Nowadays PHP has builtin http server, so you don't need any http server in your dev environment.
So in Windows:
Install PHP and enable required libraries in php.ini
Install and configure local mysql server (easiest way installing via MySQL installer)
Start development server by invoking php.exe -S localhost:80 -t "absolute-path-to-your-laravel-installation\public" like for example C:\htdocs\laravel\public via commandLine
Enter url in your favorite browser http://localhost
Hope that will help to get you started.

PHPUnit and Ubuntu - Issues with include path after Installation with PEAR

I need to install PHPUnit for a web dev project on my Ubuntu box, but am having serious issues. Using suggestions from various sources, I've installed via pear and tried the following:
Currently, phpunit --version returns
PHPUnit 3.7.20 by Sebastian Bergman
when in /usr/share but throws errors everywhere else.
My include path is
include_path = ".:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/File/Iterator"
I've tried different variations ranging from simple /usr/share/php to the full string above. PEAR is in all caps since that is the folder it is in.
Executing with a test case results in
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream:
No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 64
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. require() /usr/bin/phpunit:43
PHP Fatal error: require_once(): Failed opening required
'File/Iterator/Autoload.php'(include_path='/usr/share/php/libzend-framework-php')
in /usr/share/php/PHPUnit/Autoload.php on line 64
pear list -c phpunit returns
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
File_Iterator 1.3.3 stable
PHPUnit 3.7.20 stable
PHPUnit_MockObject 1.2.3 stable
PHP_CodeCoverage 1.2.10 stable
PHP_Invoker 1.1.2 stable
PHP_Timer 1.0.3 stable
PHP_TokenStream 1.1.5 stable
Text_Template 1.1.2 stable
I've confirmed that Autoload.php exist at both php/PHPUnit/ and php/File/Iterator/
My loaded php.ini file is at `/etc/php5/cli.php.ini1 as verified by
php --info | grep "onfiguration"
Any other suggestions would be appreciated.
Search for a file on your computer that is called Autoload.php and is in a file structure like this:
../File/Iterator/Autoload.php
Now open the file that throws the error (/usr/share/php/PHPUnit/Autoload.php in your case) and include a set_include_path statement that points to the absolute path of that file.
You seem to have a very similar problem to what I experienced on Mac OSX. For more information look at this very similar question. If all of this doesn't help, try to install with Composer, which I have heard doesn't have this issue.
For recent projects, I'm using Composer to install PHPUnit and the other related tools. It's quite easy:
## ... rest of the composer.json file
# "php -f composer.phar update --dev" to install
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
I also then have a shell script to actually run the PHPUnit command-line tool from the ./vendor/bin/ directory where a link to the locally installed script is installed.
Like Alister's answer, relying on Composer,
but I prefer to deploy the updated PHPUnit globally across my projects with:
composer.phar global require "phpunit/phpunit=dev-master"
That way, when I am at the root dir of my Symfony project, I can just run
~/.composer/vendor/bin/phpunit -c app/ -v --filter testFireNotifications |tee phpunit.log
That last bit with --filter was to run something selectively (actually, more for fast web automation via crontab, than testing...)
Even on a current Ubuntu 14.04.2 server, the repo is stuck with an outdated PHPUnit 3.7.28 "stable", so I sidestep the OS-provided one with this custom install that won't conflict (I haven't put ~/.composer/vendor/bin in my PATH).

Getting codeception & phpunit working on MAMP with OS X Lion

Running:
MAMP 2.0.5
PHP 5.3.6 (bundled with MAMP)
Mac OS X Lion 10.7.2
My goal is to get the Codeception testing framework to work and use within my MAMP project. I'm following the instructions here on how to install it.
Pear is installed and working fine. I am able to get Codeception installed with these commands:
$ pear channel-discover codeception.com/pear
$ pear install codeception/Codeception
Once installed when I try to run the codecept commands I get the following error:
Warning: require_once(Codeception/autoload.php): failed to open stream: No such file or directory in /usr/bin/codecept on line 12
Fatal error: require_once(): Failed opening required 'Codeception/autoload.php' (include_path='.:') in /usr/bin/codecept on line 12
I think that the issue is caused by either:
A conflict between MAMP's PHP installation in the one bundled with OS X
An issue with the include_path in my php.ini or somewhere else
Also of interest
When I run the $ phpunit command from inside my project folder I get -bash: phpunit: command not found but if I run it as $ /Applications/MAMP/bin/php/php5.3.6/bin/phpu
nit it works just fine.
I would expect there to be a codecept file in /Applications/MAMP/bin/php/php5.3.6/bin/ but there isn't - there is however a Codeception folder in /Applications/MAMP/bin/php/php5.3.6/lib/php
I've tried a few different ways to install it, and I guess one of the ways installed Codeception in Lion's copy of php (as opposed to MAMP's) - so I do have a codecept file in /usr/bin/ as well as the Codeception folder in /usr/lib/php/pear/
For reference:
PHP lives here: /Applications/MAMP/bin/php/php5.3.6/bin/php
Pear lives here: /Applications/MAMP/bin/php/php5.3.6/bin/pear
PHPUnit lives here: /Applications/MAMP/bin/php/php5.3.6/bin/phpunit
Any Help? Suggestions?
Thanks to Davert's help - I was able to confirm that this is a conflict with MAMP's copy of PHP and Lion's built-in copy of PHP. To solve the issue I created a new php.ini file in /etc that was a duplicate of php.ini.default and changed the include_path to /Applications/MAMP/bin/php/php5.3.6/lib/php
I think the problem is: your PEAR command was executed from bundled PHP. So your primary MAMP PHP libraries in (/Applications/MAMP/bin/php/php5.3.6/bin/pear) were not updated. I suggest you should find the second PEAR were the Codeception was exctually stored. And add path to it into 'include_path' in php.ini.
Yes, PEAR is quite buggy. In next releases a Composer installator will be added.
Also, you can try to use Phar executable.
In this case a Codeception should be executed with:
php codecept.phar
One solution that worked for me was to edit /Applications/MAMP/bin/php5.3/bin/codecept and replace /usr/bin/php at the first line by /Applications/MAMP/bin/php5.3/bin/php

Error using propel, it can't find build-propel.xml

When trying to create a build using propel-gen (propel v 1.4) I get:
[phing] Error reading project file
[wrapped: Unable to open
/path/to/project/build-propel.xml for
reading: ]
I can't find a reference to this file in the propel documentation.
Definitely a problem with the latest phing.
You should try :
$ pear uninstall -n phing/phing
$ pear install phing/phing-2.3.3
I realised that it was looking for files which are located in the propel/generator directory, but was using the current working directory as the base directory (I have propel-gen symlinked to /usr/bin so I can run it from anywhere).
The (kind of crappy) solution is just to cd into the propel/generator directory and run the build from there, so it uses that directory as the base path.
What version of Phing are your using? (Run phing -v to find out). Phing 2.4.x, the latest version, seems to break backwards compatibility, but it works with Phing 2.3.x, so try to downgrade to that version for now.

Categories