When I try to run my project in localhost I am getting the above error.
The thing is I already installed the composer. In terminal I get the confirmation saying
Composer (version 1.4.2) successfully installed to: /home/martin/composer.phar
Use it; php composer.phar
Even I tried the command composer It is showing the Composer things.
What should I do to get rid of the error Fatal error : Uncaught Runtime Exception ....
For this issue you need to change php files.
1.php.ini
You can add the Zend Framework’s library path to the PHP include_path.
You can find include_path in php.ini.
Example #1 Unix include_path
include_path=".:/php/includes"<br>
Example #2 Windows include_path
include_path=".;c:\php\includes"
2.httpd.conf
You should set an environment path named ‘ZF2_PATH’ in httpd.conf (or equivalent). i.e. SetEnv ZF2_PATH /var/ZF2 running Linux.
Related
I am trying to int Zend framework 2. I aready have xampp running. I followed the steps on this answer. How ever when I visit the url I specified I get the following descriptive error:
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable.' in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php:51 Stack trace: #0 C:\xampp\htdocs\ZendSkeletonApplication\public\index.php(18): require() #1 {main} thrown in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php on line 51
as the exception states. I went on to run the command php composer.phar install
and nothing happens. nothing displays on th cli to showing anything being installed. and when i run again application i get the same error. Where else can I look and check for errors. Thanks
I am using PHP Version 5.6.8
So what worked for me. I began again from scratch following the tutorial here
Then I still got a "could not open input file: composer.phar" when I ran the command: php composer.phar install
so according to "www.softanalyst.com/zend-2-framework-installation-with-xampp/#comment-883" I need to run the following command:
php -r "readfile('https://getcomposer.org/installer');" | php
which I did and it all worked.
open up your terminal and move To your project using the cd project directory
one type dir composer.phpr and try this one dir composer.json if both file listed than do the next step otherwise download the composer in current directory and run the following command as bellow.
php composer.phar install this comman will install all required dependency from the composer.json file. it will take time as depend on internet speed.
once it's complete than try this link for further steps.this link also having how To install composer And skeleton application.
Github
Twitter
I'm trying to execute ZendSkeletonApplication example for frist time.
I've acted pursuant this articles from official Zend site:
http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html
BUT
Why should I download again all dependecies (entire ZF2) via composer if I already downloaded it (ZF2) from Git as zip archive?
Or Does part with php composer doing anything else than downloading entire ZF2? (I've very slow connection so it's problem)
I still get this error:
Fatal error: Uncaught exception 'RuntimeException' with message
'Unable to load ZF2. Run php composer.phar install or define
a ZF2_PATH environment variable.'
My approach is following: (Using Win7, PHP 5.3.5)
I downloaded entire ZF2 and ZendSkeletonApplication from Git as zip archives.
I Unziped ZF2 to htdocs/ directory. (Now my path to the framework is: xampp/htdocs/ZendFramework-2.3.1/ )
I Unziped ZendSkeletonApplication to htdocs/ (Path location: xampp/htdocs/zf2-tutorial/ )
I checked presence of openssl extension. It's now enabled in php.ini
I added the Zend Framework’s library path to the PHP include_path in php.ini
( include_path = ".;C:\xampp\php\PEAR; C:\xampp\htdocs\ZendFramework-2.3.1\library" )
Now, If I type: localhost/zf2-tutorial/public/ , I get FatalError as I mentioned above..
Need I setup some other settings in ZendSkeletonApplication?
Is it possible to install dependencies via php composer from downloaded zip archive of ZF2? (No internet connection) ... If so, How can I setup the composer?
EDIT:
After XAMPP update (php 5.5) I was capable to successfuly access ZFSkeletonAppllication's introductory site (localhost/) after I set ZF2_PATH environment variable.
Ok, but unfortunately same FatalError still occur right when I got to the next chapter of ZF2 SkeletonApplication:
http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html
There, PHPUnit framework has been involved to ZF2 application.
When I want to run phpunit I get same error as above:
Fatal error: Uncaught exception 'RuntimeException' with message
'Unable to load ZF2. ....
I setuped ZF2_PATH environment variable in httpd.conf to:
SetEnv ZF2_PATH c:/xampp/htdocs/ZendFramework-2.3.1/library
I really don't know what I can do now...
Thanks for help.
Chances are include_path not working. You need to debug it why. Otherwise you can set ZF2_PATH environment variable as error itself demanded. It is easy way as you may setup framework at one folder while just need to setup ZF2_PATH variable. For debug, how ZF2 autoloading works, check /init_autloader.php .
No need to using composer every time for project setup. I also found it very annoying in composer way to install every time ZF2.
I am running phpStorm 7.1.3 version on Windows 7 and I have done everything accordingly to install composer and then phpunit. Now I have it in vendors directory. But every time I run my program which is a simple Yii application I get the same error.
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'Cannot create phar
'C:/wamp/www/myproject/vendor/bin/phpunit', file extension (or
combination) not recognised or the directory does not exist' in
C:\Users\myUser\AppData\Local\Temp\ide-phpunit.php:177
Please help, I am stuck here already two days and cant get this working, almost changed and reinstalled everything but is not helping.
I didn't use pear, I downloaded everything through the phpStorm. I downloaded composer, and after that through phpStorm composer I downloaded phpUnit 3.7.37.
Here is the screenshot of my settings for composer
Here is the content of my composer.json
{
"require": {
"phpunit/phpunit": "3.7.37"
}
}
Here is the screenshot of my settings for PHPunit
On your 2nd screenshot (PHPUnit settings):
Why did you choose PHAR option if you are using COMPOSER?
Why did you point to .../bin/phpunit (even if you choose 3rd option .. you should point it to a PHAR file then)?
Therefore:
For composer installations you should use 2nd ("Use custom loader") option.
The edit box -- you should point it to your autoloader script (yes -- composer autoloader script).
Related (similar issue): https://stackoverflow.com/a/17316104/783119
If you are not using composer, but the 'Path to phpunit.phar' option and still receive this error, just make sure the path you specify ends with a .phar (usually ends with phpunit.phar) I was seeing this same error but because I had the path pointing to my command-line alias, not the actual .phar file, it gets hung up on the improper extension and bails.
I was trying to run phpUnit on zend framework 1.12.9 and had the same problem - solved it by changing path to phpunit.phar to use custom loader.
Then You have to point it to the generated autoload.php by composer.
In my case that was
C:\wamp\www\phpu3\vendor\autoload.php
Later, the important thing to do was to point the bootstrap file from tests.
When you download the phpunit.phar file using the wget command, following the instruction on the getting started manual -
https://phpunit.de/getting-started/phpunit-4.html
the "phar" extension is being removed, and PHPSTORM has issues to interrupt this file. I've changed the extension:
mv phpunit phpunit.phar
make sure you update the path to phpunit.phar file in the IDE setting accordingly
I have two server setups on my local computer one is Zend Server and one is a Wamp because I wanted to start working with Symfony 2 and it would not install on Zend.
When I try to install composer I select the php.exe in my wamp folder but I keep getting this error at the end of the install.
ERROR:
The php exe you selected does not match the one found in your path.
Selected: C:\wamp\bin\php\php5.3.13\php.exe
In Path: C:\Program Files (x86)\Zend\ZendServer\bin\php.exe
Remove the following from your System Path Environment variable:
C:\Program Files (x86)\Zend\ZendServer\bin
Warning: Only do this if you are sure that it will not affect anything else.
In my case it is
Composer Installation Error
select where php.exe is located
I solved the issue by using
C:\wamp\bin\php\php5.4.12\php.exe
and rerun the
windowpowershell by typing in start->search (run)
then composer in terminal
need11.com
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