laravel : php artisan suddenly stop working - laravel

I know that there bunch of questions out there but mine doesn't seems fit in any.
I am working on laravel. php artisan was working fine an hour before. After that i just created a controller, a model and few views blade.
Now artisan simply won't work and no error at all. Even php artisan --version won't show anything.
I DIDN'T do any major changes like composer install, or update or install any new package. Neither any server configuration. It was just basic coding on controller , model and views.
Not sure what is causing this. What could be the reason and how shall i start debugging it?

Artisan is an integrated part of Laravel, meaning it's using a console Application instance to run a command, and it will stop execution for errors which may come from any part of your application.
Syntax errors can be a common culprit that will stop artisan from working, and if debugging is not enabled errors are not displayed (just logged) so you get no output when running a command.
To search for syntax errors, go to your project directory and try linting the entire directory by running this command:
find -L ./ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | grep "Errors parsing".
If any syntax errors are present, the command will output the first file that has an error, the line where it occurs and the error message.

In my case, there were no problems with files and syntaxes. But when I reinstalled the dependencies it worked.
composer install
run above command in your working directory and it worked.

Related

Laravel command not found. Tried to add to PATH but it's not working

I'm trying to install and run Laravel on my Mac machine, but my command line doesn't recognize laravel and responds to all laravel commands with "bash: laravel: command not found". I know that the composer bin folder needs to be added to the $PATH, so I went to my home folder and, since none of the profile files I was told to look for were present, I created a .bash_profile file and added the line "export PATH = $HOME/.composer/vendor/bin:$PATH" to it. However, after saving this and restarting my terminal, laravel is still not recognized. Does anyone see what I'm doing wrong here?
I assume you are trying to do laravel new blog. To work you should call composer global require laravel/installer.
In case this doesn't work for you use composer create-project --prefer-dist laravel/laravel blog

Can't find /root/.composer/vendor/bin/laravel: No such file or directory

I have installed composer on Centos 7 virtualbox with PHP 5.6.27. I will show the commands that I have used and the issues that I am now having. I should first say that all of these commands have worked on previous installations.
Okay so for starters here is what I used to install composer.
curl -sS https://getcomposer.org/installer | php
Followed by
mv composer.phar /usr/local/bin/composer
Now I am trying to install laravel via the commands listed below.
composer global require "acacha/adminlte-laravel-installer=~3.0"
Up to this point all of the commands listed above have successfully worked.
Now here is the current problem. When I try to run the following command I get an error.
laravel new laravel-with-admin-lte
-bash: /root/.composer/vendor/bin/laravel: No such file or directory.
I have tried a whole set of remedies for this message but it cannot find the .composer directory. Can anyone tell me where the correct .composer directory is and how I can modify it so that it looks to the proper location to finalize this installation?
I appreciate any solutions that you can provide me. I have struggled with this for two days straight and have googled everything under the sun. Hopefully, someone on here has had a similar solution with a valid resolution.
Put an alias to the freshly installed Laravel installer in your user configuration .bashrc:
nano ~/.bashrc
And place this inside the file:
alias laravel='~/.config/composer/vendor/bin/laravel'
And run the following to make sure your bashrc profile is reloaded:
source ~/.bashrc
laravel new project
download as superuser
download installer
sudo composer global require "laravel/installer=~1.1"
setting up path
export PATH="~/.composer/vendor/bin:$PATH"
check laravel command
laravel
I had the same problem, so I changed the directory.
This is the directory where your bash was created: /root/.config/composer
enter image description here
but when excute the laravel command, the system search en the directory : bash: /root/.composer/vendor/bin/laravel:
enter image description here
So, just you need to change the address /root/.config/composer/vendor to /root/.composer/vendor.
PD. sorry I am learning english, so it is a little bad.

Laravel php artisan serve doesn't work

I have Laravel 5.3.16 installed. I have built my projects and until now it would work properly. but for the past few days I can't connect local host. I use the following command on mac terminal,
php artisan serve
and in terminal it's fine, but on my browser I get an error of server being busy!
can anyone tell me what is the problem?
The issue might be that the time you ran 'php artisan' serve wasn't stopped. You can check this by doing following steps:
Assuming you are on a OSX computer:
Open terminal
Run: ps -ef | grep php
Lookup if there is currently a Laravel process in use.
Get that id that is running the instance and kill it.
kill 012345
Try to run the command: php artisan serve again.

Artisan returns blank

Whenever I run any php artisan command like php artisan list, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
changing permissions for /root/.composer to 777
remove bootstrap/compiled.php file
There is nothing in app/storage/logs/log-cli-.txt.
I can view the site in the browser.
I'm running on CentOS 6.3 64bit with PHP v. 5.5.11 - Laravel 4.1
This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?
Edit the file artisan and add the following lines just after the PHP opening tag <?php:
ini_set('display_errors',1);
error_reporting(-1);
Try running artisan again and see if there is any output.
If that doesn't work try reverting app/start/global.php to it's default state.
Running composer install solved the problem.
The solution for me was like #TheodoreR.Smith mentioned, there was an exit in a controller's __construct(). I removed it and route:list worked fine.
Came here after a cronjob wouldn't execute because of artisan containing an error in the CLI, thanks to this answer. So dropping my answer in case it could help someone.
The solution is switching to PHP 7.1+ (7.2 in my case) due to Laravel requirements.
Switching to 7.2 for me, wasn't enough. Both Apache and CLI were switched to 7.2 but the cronjob uses the default PHP version of the server (cPanel managed). Specifically executing the 7.2 version (in stead of global PHP) solved it for me, the cronjob command is:
* * * * * /usr/local/bin/ea-php72 /path/to/laravel/artisan schedule:run >/dev/null 2>&1
(remove > /dev/null 2>&1 if you want to see the output and bugfix the commands)
Make sure you don't have any exit() or die() in your route file.
That was the issue in my case as I was in the middle of testing some code in the route file when I realized that I couldn't run any artisan command.

Laravel composer signal "11" error symfony osx

Anything I try to execute in Laravel, even minor files locally gives this message in composer:
[Symfony\Component\Process\Exception\RuntimeException]
The process has been signaled with signal "11".
Using OSX 10.7.5
Any help appreciated, as always.
For example :
composer update
typed in terminal retrieves the error message above
Make sure to check your composer cache folder has the right permissions for all files and folders.
If you ever ran composer as sudo or root then these cache folders could have the wrong root permissions.
Look at all the files and folders inside:
ll ~/.composer/cache/
Make sure you have proper permissions to write files in app/storage directory. And you can always use the following method of installation.
cd /your/app/directory
git clone https://github.com/laravel/laravel.git .
composer install
I got this error due to circular dependency on AppServiceProvider (when 2 services depend on each other). As the error does say much it took me a loooong time figure it out :/
Try:
Reinstall or upgrade PHP (Cli)
Make sure your .composer directory permission
This error message from laravel artisan is caused by Composer command error, you can try the same way from using command like:
composer dump-autoload -o
It should also cause error relating from aristan optimize command which be trigger from post-update-cmd" in composer.json.
In my case, the error is segment fault via Cygwin PHP so that I change to use XAMPP PHP to run it and it worked.
Try to run thin command
composer dump-autoload
I eventually solved this by employing a freelancer who was excellent and very knowledgeable.
First needed to update OSX with Maverick (free) - (I had to change my hard drive to do this!)
Then needed to download xcode
Composer should then function, you may need a new installation of laravel
Hope that helps someone!

Resources