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
Related
I am new to php and usage of composer in php. I am using windows 10.
While trying to delete previous installation of composer I think I have mistakenly deleted the composer folder inside phpMyAdmin. Now I am getting the below error while trying to access http://localhost/phpmyadmin/ :
Warning: require_once(C:\xampp\phpMyAdmin\vendor/composer/autoload_real.php): failed to open stream: No such file or directory in C:\xampp\phpMyAdmin\vendor\autoload.php on line 5
Fatal error: require_once(): Failed opening required 'C:\xampp\phpMyAdmin\vendor/composer/autoload_real.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\phpMyAdmin\vendor\autoload.php on line 5
was there supposed to be a composer folder inside phpMyAdmin by default? Did I delete something that was used by mysql?
How do I solve it?
The vendor folder is required yes. If there's a composer.json file present in your phpmyadmin folder you can run composer install to fetch all dependencies into the vendor folder.
Go To xampp>phpMyAdmin first then run "composer install" on your git bash or any other terminal.I hope it will work
My friend, who just started a company, sent me this website (https://github.com/lexaugustin/bamboufacile) that someone built for him out of a PHP template, so I can host it for him on "hostgator.com". When I run the public folder with XAMPP, I only see the template website, and when I try to run the server.php that is in the root directory, I get these two errors:
1) "Warning: require(/opt/lampp/htdocs/public/../vendor/autoload.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/public/index.php on line 24
2) Fatal error: require(): Failed opening required '/opt/lampp/htdocs/public/../vendor/autoload.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/public/index.php on line 24.
Can someone help me run this file and tell me how to host PHP website on hostgator, please? The tutorials on hostgator haven't worked for me.
The project link you have mentioned is a laravel project. The error shows it has missing dependencies. So first thing you will need to install composer to install its dependencies.
Once you are done with the installation open command line and cd to your project directory in xampp htdocs. Run this below command to install the dependencies. Also you will need minimum php 7.1.3 in your xampp and hostgator to run this project.
composer install
A friend send me a project but it is give me an error when i try run.
I go to project location and execute php artisan serve but i have this error:
Fatal error: require(): Failed opening required '/project1/bootstrap/../vendor/autoload.php' (include_path='.:') in /project1/bootstrap/autoload.php on line 17
When i run composer install i have this error:
[ErrorException]
file_put_contents(/project1/rev2/bootstrap/cache/ser
vices.php): failed to open stream: No such file or directory
What is the problem?
Thank you
Do you compose installed ? if not you can install it form here.
https://getcomposer.org/
Once composer is installed then you can run php artisan serve or you can place the project in the wamp/xampp project directory and run like this.
http://localhost/projectname/public
Make sure you have /project1/rev2/bootstrap/cache directory in your project location if not, you have to manually create it.
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.
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!