I'm stuck on a very basic problem:
I'm trying to use Laravel, which I installed on my windows 7 with composer.
When I try to access my website locally with Wamp, I get the error:
Warning:
require(C:\wamp\www\sitedirectory\public\protected\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\wamp\www\sitedirectory\public\protected\bootstrap\autoload.php on
line 17
Everywhere I can read that all I have to do is run composer install or update.
The problem is that I did run both and nothing has to be updated.
The files are where they are needed so I dont understand what could be the problem.
Does anyone have an idea of what could be my problem?
Thank you in advance.
Composer is a tool for managing and installing dependencies.
There should exist a file named composer.phar in the directory C:\wamp\www\sitedirectory\public\protected\. There you should execute the command composer.phar install (on the command line).
Then, the directory vendor containing the autoload.php etc. should be generated.
If the composer.phar does not exist (but at least a file named composer.json), follow the steps explained here to download composer.
Related
Guys i am frustrated now, I just installed XAMPP yesterday. And I created a folder named "MyProgram" and there is one PHP file inside and basically its just a "Hello World" program. It works fine in the apache localhost.
And now when I created another new folder "MyAPI", I am trying to build another PHP thing with Vimeo API. But this time, no matter how many times I tried, I cant open my "MyAPI" folder on the localhost anymore. Usually when we open in the localhost, there will be a menu for us to choose what file to be opened, but im not sure why this is not working in this case. These are the error message:
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in D:\XAMPP\htdocs\MyAPI\index.php on line 9
Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='D:\XAMPP\php\PEAR') in D:\XAMPP\htdocs\MyAPI\index.php on line 9
And FYI, this my folder:
And this is how I installed my composer:
You need to install your project dependencies first.
Open your terminal
Navigate to your project directory:
cd D:\XAMPP\htdocs\MyAPI\
Run composer install
try to run :
composer install
composer update --no-scripts
If you get the same error also when you run them
Just run this command first
composer dump-autoload
also make sure you run these commands inside the project folder
I'm having an issue with composer. When ever I run any composer command inside a project with a composer.json file even if I run composer init on an empty directory, once the process is complete it will no longer work.
The error I get is
[JsonSchema\Exception\ResourceNotFoundException]
file_get_contents(file://): failed to open stream: No such file or directory
Its been working fine for ages and has just started doing this and i'm completely lost. I am also on windows.
I use laragon as well but I've tried installing composer on its own and still nothing
so the solution (or workaround) was:
download composer.phar https://getcomposer.org/composer.phar
run it directly in the folder
more info on how to install composer:
https://getcomposer.org/download/
I am following all steps to run a PHP Google Calendar Api. I followed this link: https://developers.google.com/google-apps/calendar/quickstart/php . In step 4 it asks to run quickstart.php, but as after running the file, it displayed me this error :
Warning: require(vendor/autoload.php): failed to open stream: No such
file or directory in
C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php
on line 2
Fatal error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php
on line 2
Here's a check-list for you to go down with Composer and vendor/autoload.php:
Does your composer.json file exist in the root of your project? (Note: This may be up a level from your document root for your web server.)
Does the vendor folder exist in the same folder as your composer.json?
Are you using the correct relative path to find your vendor/autoload.php file?
If composer.json isn't in your project root, move it there. It's where it belongs and things will continue to go wrong for you until it's there.
The vendor folder and its autoload.php file are both automatically created when you run php composer.phar install or php composer.phar update. If they're missing, you need to run php composer.phar install.
Once you've verified that vendor/autoload.php exists and is in the correct location, make sure that you have a good relative reference to that file with your require statement.
I solve this issue using the followed command:
composer dump-autoload -o
I would execute it inside of the application folder.
Example:
c:\<< your_app_folder >>\composer dump-autoload -o.
After that, you will see the "vendor" folder. The autoload.php file will inside.
For more information, access the link:
http://phpenthusiast.com/blog/how-to-autoload-with-composer
This fixed it for me
make sure you have composer installed then try the below command in your terminal
composer update
just moved over my laravel site to my live server and straight away faced with this error.
The complete error is:
Warning: require(/var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/autoload.php on line 17
The line 17 is:
require DIR.'/../vendor/autoload.php';
Folder structure is:
beta.buildsanctuary.com
-- public_html
-- subdomains
-- beta
-- local
-- bootstrap
-- vendor
Any help where this is going wrong? And how to fix? Pulling my hair out trying all sorts of paths.
Thanks, Craig.
I strongly believe that a corrupted cache was the cause, I cannot be 100% sure but it seem that it is likely the culprit.
So, if anyone comes across a similar problem, I would suggest the following steps:
Delete the vendor folder
Delete composer.lock
Run the command composer clearcache (or clear-cache)
Run composer install
I hope this can help somebody.
As you can see from the error, PHP is looking for
public_html/local/bootstrap/../vendor/autoload.php`
which is
public_html/local/vendor/autoload.php
That folder does not exist. I think the folder structure you posted is wrong.
Anyway, try this:
require('../vendor/autoload.php');
I've had the same problem and it was that Composer was not installed yet in the server, so the directories structure it creates on your project does not exist neither.
First you have to install composer on your server, follow the instructions for your system given at the composer project webpage, https://getcomposer.org/.
Next you have to go in a terminal or cmd to the base folder of your project.
There you can use the commandline composer init, wich will guide you to create your composer.json file into your project.
Once you have created your composer.json file, you have to execute the commandline composer install.
This commandline will create all the dependencies you have written on your composer.json, and also will create the folder structure so the code you require would find the proper path.
At last, you have to reference the redirection to the folder vendor depending on the current folder structure location of your php file.
If you look for information, http://www.phptherightway.com/ was really helpfull.
Just run the following command, it will automatically install necessary dependencies:
composer install
I had the same problem when I have had migrated a drupal website to new server...
To solve the problem I just used the composer command:
First cd into website directory, EX:
cd /var/www/your_website
Run composer to install drupal 8 dependencies that it's need in the website directory;
composer install
If you use the sudo command, make sure the .../vendor directory has the right permission to be accessed by the user who in the /var/wwwdirectory;
sudo composer install
This basically will solve the .../public_html/autoload.php on line 14 issue!
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.