I copied all the source code of the project (Laravel 5) to another folder under htdocs folder.
The original project is running successfully.
But the destination project has this error:
NotFoundHttpException in RouteCollection.php line 145
in RouteCollection.php line 145
at RouteCollection->match(object(Request)) in Router.php line 716
.....
Please help me figure it out.
Sorry about my English.
Well, I had a similar problem today, Although I don't know if there are better solutions out there. However, I had to re-install laravel5 with composer using the following command.
composer create-project laravel/laravel newprojectname --prefer-dist
One more thing, I also noticed that I was typing the directory location to my laravel project differently from the way I saved it locally on my development windows PC. That is I was accessing the file location like so
http://localhost/laravel/projectdirectoryname
instead of something like this:
http://localhost/laravel/ProjectDirectoryName/
In summary, I named my project directory on my local drive, in camel-case (upper-lowercase), like so; ProjectDirectoryName while, I was accessing the project in the browser, in all lowercase, like so; projectdirectoryname. Although, this may not be applicable on a linux-dev machine, because of its case-sensitive constrain. However, this is possible in a windows-dev machine
Related
I have installed composer and created laravel file using command laravel new blog and when iam using php artisan serve iam getting this error cannot even find solution for this error please hep me out.
Error Image
Server.php make a Exception and your Anti-Virus like Avast delete it Automatically. Make turn off your Anti-VIrus Software.
server.php
file is missing so you got this error, Some antivirus considers that the server.php file is a virus, So he simply removes it.
Another Solution is:
You can also manually create server.php file
1.Open the link: https://github.com/laravel/quickstart-basic/blob/master/server.php
2.Copy all code
3.Open Notepad and paste your copy code
4.save Notepad file and set name server.php
5.Copy the server.php file and paste it inside your Laravel project
6.Run your project again in browser Now you will not get an error and the Laravel project will work properly.
The file "server.php" is missing because the Anti-virus deletes it.
I'm using Laravel 9 and I find this solution.
Get a copy of server.php here: https://github.com/jayimillena/laravel9-server-php/blob/master/server.php
Copy the code and save it in this directory
If you're using XAMPP
C:\xampp\htdocs<laravel project>\vendor\laravel\framework\src\Illuminate\Foundation\Console/../resources
If you're using WNMP
C:<laravel project>\vendor\laravel\framework\src\Illuminate\Foundation\Console/../resources
Then run the code using "php artisan serve" command
I have seen this answer in many posts but they have not helped me at all. I followed the regular steps to create the laravel project like this:
I cloned from my repository.
I ran composer update.
I added 777 permissions to storage and bootstrap folders.
I have a .env file.
I verfied the .htacces and it's ok.
It is working in locahost, but when I try to replicate it in Hostinger it does not work, it displays the 500 server error. So I wonder what is the problem?
I checked the logs by the way and they were empty. I put the laravel project debugger to true too.
the website url is xellin.com
The debug:
The logs folder:
Thanks.
I think this is a good opportunity to point out how PHP / Laravel / Underlying Server interacts one to each other.
First:
The HTTP server inspects Document Root and .htaccess to get instructions.
If the file is .php (like Laravel), then it CALLS to the php handler.
The php handler could be a FPM version or a Fast CGI version.
-> If an error ocurrs parsing the .htaccess or with the initial interaction between Http Server and PHP... Laravel never runs for real. All ends in a PHP error log
To find out what's wrong, you need to inspect what PHP / Http Server said about the error in their respective logs.
In short words: at this point is not a Laravel error, but a server/php one.
Second:
If Apache/PHP runs well, then PHP executes the Laravel Applicacion Lifecycle... if Laravel encounters a problem, then you will see the usual output error of Laravel Error Handler.
I think this is a must to know to work with web apps in general, because many times developers miss to catch if the problem was with Laravel, or with PHP / Server itself.
As a side note, that's why it is important to know how to choose propper hosting service for Laravel.
Thanks for reading.
You can try to clear cache
Like as
php artisan optimize
Or
You can manually delete cache files which is located in bootstrap folder and inside bootstrap folder you can see cache folder inside cache folder delete all files except git ignore file your issue fix
If you show again this error on live serve then tou can update your composer and then run
php artisan optimize
at first, if you give any of your folders 777 permissions, you are allowing ANYONE to read, write and execute any file in that directory.... what this means is you have given ANYONE (any hacker or malicious person in the entire world) permission to upload ANY file, virus or any other file, and THEN execute that file...so please be careful because IF YOU ARE SETTING YOUR FOLDER PERMISSIONS TO 777 YOU HAVE OPENED YOUR SERVER TO ANYONE THAT CAN FIND THAT DIRECTORY. please read the full explanation from here
the second here is the detailed steps I used to deploy my projects to the server:
run npm run production then update your github repo.
clone the project from GITHUB to server - clone to an outside folder (not public_html folder)
run cd <cloned folder name>
run composer install
run npm install
copy and configure .env file to cloned folder( be sure name is .env not env).
copy all content of cloned_project_folder_name/public to public_html folder
in index.php inside public_html folder edit as below
$app = require_once __DIR__.'/../cloned_project_folder_name/bootstrap/app.php';
require __DIR__.'/../cloned_project_folder_name/vendor/autoload.php';
set your .htaccess properly.
change permission to 755 to index.php and all file in public_html folder
run composer install --optimize-autoloader --no-dev
run php artisan config:cache
run php artisan route:cache
I think I state it all, hope that will help
i'm quite new with laravel and composer. I've made a project previously and that works like a expected. Now i've started a brand new project 'bloemenn' in phpstorm choose composer project for type and installed laravel. When i run the project i see the welcome page of laravel. So far so good
But now i'm trying to make a controller with the command line tool but every command i execute points to my very first directory project i ever made.
So the controls are made but in the wrong directory.
so when i execute following command in phpstorm for project bloemenn:
Artisan make:controller indexController
i get following result:
/Applications/MAMP/bin/php/php5.6.7/bin/php /Users/u-123/project-test/laravel/artisan make: indexController
so the controller is made in project laravel instead of directory of project bloemenn
Anyone have any idea how i can fix this, i have this issue for every new composer project i start up?
ok,
found it myself
under preferences->Tools->Command Line Tools Support can you specify witch to uses
mine all pointed to my first project
I'm trying to work with Laravel 5 on NetBeans.
Now, I'm trying to var_dump through Laravel 5 to understand how the application works, and I keep getting 500 errors when I have even a simple syntax error in my code, and it doesn't output the error log like normally. From what I understand by research is that it's caused by Laravel not being able to write into /storage/ folder in Laravel.
I created a new group netbeans and added www-data user to it, so right now I'm trying to figure out how do you install it so that Laravel 5 and NetBeans could 'recognize' each other. Right now I have NetBeans installed with apt-get install, and now that I've changed the Laravel 5 project rights with:
chown -R www-data:netbeans laravel5/
Now I can't access Laravel's project files with NetBeans because of right issues. All this is sort of confusing to me, so my question is:
How do I properly setup NetBeans and Laravel so I could edit my Laravel project folders files and somehow have Laravel access /storage/ folder inside Laravel, so I would not see 500 error and a blank page on every syntax error I make?
P.S: I tried to be as precise and explanatory as I could be
Check write permissions on storage folder!
Try:
sudo chmod -R 777 storage/
(i known that 777 is a bad thing to do, only do this to test).
After reading enter link description here it could also be a problem of permissions to write to the log folder. See the last comment from shiny
Im developing a library hand in hand with a project I'm working on in L4 and I'm doing it in a Workbench as recommended. I have set the Service Providers etc and it works fine on my local machine. However when I pust to Pagodabox, the console gives me this:
Error Output: PHP Fatal error: Class 'Coderollers\Formidable\FormidableServiceProvider' not found in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 123
Clearly, for some reason, on Pagodabox it is looking for my service provider in the vendors folder rather than the workbench folder. Does anyone know why this might be?
For a workbench package to be loaded by Laravel it expects to find an autoload.php file within a vendor directory of your package. You'll need to run composer install from your workbench packages directory to install the package dependencies and have it dump an autoload file.
Once done Laravel will be able to detect and use your package.