I am developing an application in Laravel 4 using the built-in development server with a SQLite database. After a recent merge from another user in the project repository, the server will crash after certain requests.
I believe I have narrowed it down to a call of Sentry - when it is used on a request the server will crash out and the command line will exit.
$ php artisan serve
Laravel development server started on http://localhost:8000
Dwight at Dwights-MacBook-Pro.local ~/Sites/tmtbl on master*
$
As you can see, there are no error notices.
I've run composer update and ensured that Sentry is still installed correctly. I'm not sure whether this issue is Sentry specific or something else is going on. Is there something I am missing here that is causing the server to crash?
Do you use Chrome? If yes, go to the console and if you have an error, is it the same as: Failed to load resource when using Auth? Because I have the same problem with the php 5.4 server
You can use the Google Chrome browser to see the errors in the console.
Process
First run: php artisan config:cache
Second run: php artisan serve
Finally: go to your localhost and inspect your page, and then go to the console in the upper tab, you might be able to see the error.
Image of console:
Moreover, you can try:
composer dump-autoload
Related
I dont seem to understand why we need to run a Laravel app with php artisan serve vs just running it with Apache or nginx. I know that under development, we use artisan to fire up the site and after deployment to a server, you use the webserver to load up the site.
Whats the use of running the app in artisan in the first place?
The serve command is just a shortcut for the PHP Built-in Webserver, something PHP has out of the box, so the point of using it is to start testing your application as fast as you could, you just need to install PHP, Composer and your application is up (if you don't need anything else, of course). But if you already have Nginx installed, there is no point at all, just use it.
It's not wise to use the Builtin Webserver in production.
One advantage of using php artisan serve over a typical webserver during development is you can use Psysh as a debugger (Laravel Tinker) to set a breakpoint.
For example, at the line of code I want to break at I type:
eval(\Psy\sh());
Then I hit the page that will run that section of code and when it gets to that line it will break into a Psy Shell repl (in the commandline window where I started php artisan serve). Then I can inspect variables, etc. at that point of execution. It's very useful for debugging. As far as I know, you can't do this running Apache/Nginx. It has to be with artisan serve (or running automated tests).
More info here:
https://tighten.co/blog/supercharge-your-laravel-tinker-workflow
http://psysh.org/
Purpose: The purpose of using Php artisan serve (PHP builtin server) is just for testing and easy starting your project it should not be used in real website deployment.
Asset Not working: Always put your index file in public it's the beauty and security of Laravel framework and your assets will always working. if you are bore to use your custom URL like C:/wamp/www/pym/server.php then use Virtual host locally but don't but don't put your index outside the Public folder.
if you really want to use index at your Root directory then you should customize your all asset() and url() helper functions and should put your exact url Example asset('/login') should be changed to asset('localhost/yourprojectroot/login').
php artisan serve --host your_server_ip --port 8000
copy that http://your_server_ip:8000 and run it into the browser
Aside from the best answer here.
You can see the logs directly where you execute the php artisan serve, so useful in debugging.
Well, was looking for the same answer but couldn't find any that is satisfying so , if your also unsatisfied just like me try running the link returned when you run
php artisan serve
it returns
Laravel development server started: <http://127.0.0.1:8000>
copy that /http://127.0.0.1:8000 and run it into the browser , guess what it returns );the page that u first got when you installed laravel for the first time or i guess it will return the page in the routes folder which was set as /home directory or file(default home page).
In brief:
php artisan serve
starts the serve,forexample its like when your going to drive a car and you start the engine before driving whereby you can start the engine and drive at the same time ,its not neccessary to do so but depends.So to me that's php artisan serve CLI.
I have this very strange problem in laravel. I successfully put my website into maintenance mode via artisan by this command:
php artisan down
But now i have to put my website back into live mode.I tried:
php artisan up
However, the site isn't going live even though i get success message? Have you guys ever faced this issue?
Whats the fix?
I'm on :
1. Macbook pro Mamp
2. Laravel 5.1
Thanks
artisan up command simply deletes storage/framework/down file. Please check if the file exits after you execute the up command. If it still exists, it seems like a file access issue. Whenever you run down/up commands, make sure that you run them as the same user that is running your application.
In order to get the site up and running again, remove the storage/framework/down file manually.
I installed Symfony2 on Windows 8.1. The files are stored under IIS in wwwroot.
Everything runs very well when I use the internal built-in PHP server. I can access the site through localhost:8000/app_dev.php.
When I try to access the site straight through localhost (localhost/test_project/web/app.php), I can get to the site, but it doesn't update with my changes even after I close the browser and completely reload the site. I have the same problem on the internal PHP server when I try localhost:8000/app.php - my changes aren't there.
Questions:
1. Why are my app and app_dev showing different content?
2. How can I set up Symfony to run on IIS and not need the internal server?
Because app.php uses cached files and you need to clear framework cache to see your changes. It is production version of your web.
php app/console cache:clear --env=prod --no-debug
localhost/test_project/web/app_dev.php
Please look at official Symfony documentation for explanation.
I tried installing laravel.
I installed xampp then the composer.
I followed the documentation but when i'm installing laravel, i always get this:
http://i975.photobucket.com/albums/ae238/Mochi_Ongpin/help_zpsb8870025.png
Can someone please help me? I already tried several times but failed.
Your Laravel is already installed, it timed out in the very last thing it does, which is create the compiled classes files bootstrap/compiled.php. If this file is present, delete it (it's not really necessary) and try to use your Laravel installtion.
Why is it timing out? Not sure, but you can, later, try to execute the command manually:
php artisan optimize
EDIT:
You successfully installed a Laravel application, but there is at least one other variable in this process: a web server. Without it you cannot see that success message.
Being on Windows you probably will have to install Apache 2 or WAMP, then create a Virtual Host for your Laravel application and hit: http://localhost/ to see that message.
You can also try to use Laravel's internal PHP server:
php artisan serve
And in your browser go to
http://localhost:8000
Just playing with Laravel 4 for the first time after using version 3 for a few projects but can't seem to get Artisan to work at all. I've done a bunch of searching and followed the troubleshooting steps I could find but no luck.
I've got Mcrypt installed
I had no bootstrap/compiled.php file to delete
I have the latest version of the framework from Github
I am on the latest version of Composer
When I try "composer update" I get this error:
Script php artisan optimize handling the post-update-cmd event returned with an error:
...with no extra information.
Trying to run "php artisan list" or any other artisan command just gives me no output at all.
Any ideas?
To summarise the discussion in the comments, we discovered that adding logging at the php.ini level revealed a PHP error that was not reported by the Composer console interface. I wonder whether you had installed Composer as root, and so some critical files required by Laravel were effectively invisible for a non-privileged user.
After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. My error logs were showing "Call to undefined function mb_regex_encoding".
Once PHP was recompiled with mb_regex_encoding, the issue went away.
If you are missing the /bootstrap/start.php file, you don't get helpful error messages from artisan and composer responds the same way. I went around and around trying solutions I found online and ultimately discovered this file was missing. I was back online as soon as I replaced it. I discovered this file was missing in my PHP error logs and artisan wasn't generating logs since it was unable to run.
I had a similar problem. Even the command $ php artisan --verson would not produce any output. Turned out, I had some code under app/start/global.php which was breaking under the CLI execution (but not breaking on the web side).
So that's another place to check for stuff! (app/start/global.php)
I was getting this problem, and it was because the subdirectories of storage did not yet exist.
Of course, these directories are created by the project-creating script, but they're quite easy to leave out of source control and so will be missing on a freshly cloned project. The .gitignore files are in there for a reason it would seem!
This problem occurred for me when there were files in the storage folder that were not writable for the current user. php artisan silently failed, without output. Changing permissions helped.