Composer Installation Error - php

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

Related

Symfony 3.3 built-in server error

I'm developping an app under windows 10 + wamp + php 7 + Symfony 3.3
I'm trying to use the built-in server :
php bin/console server:run
[OK] Server listening on http://127.0.0.1:8000
// Quit the server with CONTROL-C.
And when I go to http://localhost:8000/app_dev.php/ or http://127.0.0.1:8000/app_dev.php
I get this error :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:\wamp\www\myproject\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Same error under every routes. My routes are correct and works fine outside of the built-in server...
Can you help me with this issue please ?
I had same problem,
Solved by :
Delete symfony folder in vendor
composer update
If you have antivirus (like Avast) disable it before launching web
server
php bin/console server:run
I got the same error, even when installing via composer.
It turns out that for whatever reason when composer downloaded the project, the required file listed in the error you get (vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php) was not included...
To fix this, I manually added it from https://github.com/symfony/web-server-bundle/blob/master/Resources/router.php and then my symfony app worked as expected.
I had to restart my computer in order to actually add the file because somehow I was locked out of adding it even as admin in Windows after launching the php server.
UPDATE:
Even better than manually adding the file, I just deleted the symfony folder from the vendor folder in the project and reran composer update. the router.php file is indeed downloaded. Sometimes when running bin/console server:run it gets deleted. Not sure why.
It happened to me when upgrading from Symfony 3.1 to Symfony 3.4.
The reason was that I had left the development server running when I executed the command:
composer update
The solution:
Delete the contents of vendor folder
Execute composer update
Install the new Symfony development server bundle (follow the instructions)
Execute the server for development in a new port
php bin/console server:start localhost:3421
I had this problem too : it was AVAST that blocked the "router.php" file.
I went into avast -> protection -> quarantine, and put an exception of the router.php file
And then everything worked again
I get the same error and I solve this issue by installing the project with composer
composer create-project symfony/framework-standard-edition my_project_name

Laravel Error loading vagrant file

I have a freshly installed Laravel. I did a vagrant destroy --force before installation.
Every time I run anything using vagrant on my laravel project directory, I get this error.
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.
Path: /Applications/MAMP/htdocs/Sites/project-flyer/Vagrantfile
Line number: 12
Message: LoadError: cannot load such file -- /Applications/MAMP/htdocs/Sites/project-flyer/vendor/laravel/homestead/scripts/homestead.rb
exit 1
Now, I've checked, looking for homestead.rb but vendor/laravel/homestead folder doesn't exist. I'm lost.
It seems there is a broken homestead installation in your directory. You could do:
Deinstall the existing homestead with composer remove laravel/homestead
Reinstall homestead with composer require laravel/homestead --dev
Initizialie homestead and Vagrant configuration php vendor/bin/homestead make
For details you can also consult the homestead documentation.

Getting [ErrorException] - installing yii2 using composer

I am trying to install Yii2 on WAMP using composer.
c:\Users\username>php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0
I am getting the following error when I run the command which is given above.
[ErrorException]
Argument 1 passed to Fxp\Composer\AssetPlugin\Repository\BowerRepository::createVcsRepositoryConfig() must be of the type array, null given, called in C:\Users\username\AppData\Roaming\Composer\vendor\fxp\composer-asset-plugin\Repository\AbstractAssetsRepository.php on line 136 and defined
Can someone help solving this error? But, it is created a folder named "basic".
I have copied this folder to D:\wamp\www and when I access localhost/basic/web/ from browser, I am getting the following error.
ReflectionException
Class yii\debug\Module does not exist
I am following the instructions to install yii2 from http://www.yiiframework.com/download/
Please assist me to resolve these issues.
Thanks
First windows does not have a curl processor like unix so you need to use the other option for installing Composer
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
For this to work you need the php.exe processor to be on your path, so you have 2 options here. Either add the c:\wamp\bin\php\phpx.y.z folder to your PATH or my prefered option write yourself a little .cmd file which will do it for you like this
addphp.cmd
PATH=%PATH%;c:\wamp\bin\php\phpx.y.z
Put this file in a folder already registered on your path so you can run it from anywhere in a command window.
Now you will have to edit the \wamp\bin\php\phpx.y.z\php.ini file. This is similiar to the one used by php code run through the Apache web server but is only used by the PHP CLI (Command Line Interpreter)
Make sure the extension php_curl is uncommented or the above line wont work i.e. remove the ; comment symbol
extension=php_curl.dll
So now run a command window, cd into the folder that you want composer installed into and run the command above, then follow the rest of the install instructions on Install instructions
EDIT: Thank you for reminding me.
This error happens because of invalid json on plugin you or application requested (npm or bower).
The link here suggests you to run:
composer global update.
This will update composer cache. Hope it helps.

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.

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

Categories