I have started a new Laravel Project and wanted to test it on my localhost...
When I view the site I get an error message saying:
Warning:
require(C:\xampp\htdocs\public/../Website/vendor/autoload.php): failed
to open stream: No such file or directory in
C:\xampp\htdocs\Website\public\index.php on line 24 Fatal Error:
require(): Failed opening required
'C:\xampp\htdocs\Website\public/../Website/vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\Website\public\index.php on line 24
I looked it up, but I found the autoload.php file in all folders and I already tried composer update --no-scrips. I just don't get why it isn't loading the project.
'Website' is the name of my Laravel project folder btw.
I fixed the problem thanks to apokryfos.
In the autoload file the DIR.'/../vendor/autoload.php' was changed to DIR.'/../Website/vendor/autoload.php' which was the wrong path. I don't know how this could happen, but simply deleting the 'Website/' seemed to fix the problem.
Thanks again to apokryfos.
Turns out I didn't enable openssl in my php.ini so when I created my new project with composer it was installed from source. I changed that and ran
composer update
now the vendor folder was created
Related
I used composer install in the folder C:\xampp\htdocs\PhpstormProjects, exactly where my website files are located. Now, when I want to view the local version of my files at http://kabel.local.dev:8080, I'm getting these errors:
Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\PhpstormProjects\www\index.php on line 14
Fatal error: require_once(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\PhpstormProjects\www\index.php on line 14
I am probably using the wrong path but I'm not sure which path I should use? I tried C:\xampp\htdocs\PhpstormProjects\vendor but my cmd says that doesn't contain composer.json, the cmd tells me
No composer.json in current directory, do you want to use the one at C:\xampp\htdocs\PhpstormProjects? [Y,n]?
Is your vendor folder in C:\xampp\htdocs\PhpstormProjects\ ?
If yes, you have to execute composer update in your C:\xampp\htdocs\PhpstormProjects\www\ folder.
By default, you have to execute composer commands at the same location where your index.php is located.
OR you can change in your index.php the line
require_once('vendor/autoload.php');
to
require_once('../vendor/autoload.php');
In your index.php file, try update the line 14 of
require_once('vendor/autoload.php');
to
require_once('vendor'.DIRECTORY_SEPARATOR.'autoload.php');
If this not work, please, send for us an picture for the folder structure or an snippet of your index.php
Somebody send me a site to work on so I setup my MAMP webserver, extracted the drupal8 files into the htdocs folder, I setup the database in phpMyAdmin and run the MAMP servers.
When I try to reach localhost I get a HTTP ERROR 500, of-course I check the logs for errors and find this:
[02-Aug-2017 16:14:24 UTC] PHP Warning: require(C:\MAMP\htdocs/../vendor/autoload.php):
failed to open stream: No such file or directory in C:\MAMP\htdocs\autoload.php on line 17
[02-Aug-2017 16:14:24 UTC] PHP Fatal error: require(): Failed opening required 'C:\MAMP\htdocs/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\MAMP\htdocs\autoload.php on line 17
I thought this had something to do with composer so I reinstalled it and ran cmd
composer install
In installed some files + generated some autoload files which is what i thought was going to solve my problem, but i still get the same error and i feel like im missing something really obvious. Ive been stuck for so long on a small problem.
Hope someone has an answer for me!
SOLVED
It was a pathing error in the autoload.php file
return require DIR . '../vendor/autoload.php';
changed to:
return require DIR . '/vendor/autoload.php';
I am new to this but I am trying to view a repository through localhost and I am receiving this php error in the mamp log:
PHP Warning: require ..... failed to open stream: No such file or directory in .......autoload_real.php on line 58
PHP Fatal error: require(): Failed opening required
....autoload_real.php on line 58
On Line 58 is the following:
function composerRequireec02cd7cea0c14cd8638fe929f5e7e81($file)
{
require $file;
}
I think it might have something to do with the laravel version but i'm not sure. The other thing is that when I try to see errors in the laravel log there is no log in app/storage
First give the read permission to storage and bootstrap directory in your laravel project and then reload your laravel project in browser.
It seems to work now after doing composer-dump autoload then a composer update, although I was looking for more of a global answer as to why this might be happening (i.e. outdated laravel version etc.). But thanks everyone!
I have created a Laravel project using PhpStorm but when I open index.php in the browser it shows some errors.
It opens http://localhost:63342/METU/public/index.php but it should be http://localhost:63342/index.php.
Warning: require(C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
What is wrong with my project?
That error generally occurs when you haven't run composer install on a new laravel project. The autoload file it references will be created when you run that command.
As for the URL issue, you want to make sure your localhost is mapped to the /public folder of your laravel project, not mapped to the root of it.
I installed the pear/http_request2 version 2.2.1 using Composer in my project but when I am trying to make my first request I am getting this Warning and Fatal error:
Warning: require_once(Net/URL2.php): failed to open stream: No such
file or directory in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
Fatal error: require_once(): Failed opening required 'Net/URL2.php'
(include_path='/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/pear_exception:.:/Applications/XAMPP/xamppfiles/lib/php')
in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
I appreciate any help on how to fix it, thanks in advance.
David.
This should work:
composer require pear/http_request2:2.2.1
By default pear/net_url2 should be installed which has the required URL2.php file (./vendor/pear/net_url2/Net/URL2.php).
Then make sure you're including vendor/autoload.php file in your scripts to load automatically the include paths (see: vendor/composer/include_paths.php file).
Here is a simple PHP command to test this out:
php -r 'require_once "vendor/autoload.php"; require_once "Net/URL2.php";'
Note: The above command should run without any errors.
Related: Errors in the autoloaded HTTP/Request2 code, how to troubleshoot composer?
You need HTTP_Request2 from git master, because it has not been released/tagged yet at the time of writing.