laravel : php artisan not working - php

I know there is bunch of answer out there and none of them solved my problem. I am giving a try again in 2016 may be some one can help.
php artisan make:migration createxxxtable
don't show any error and it don't create the file
neither of these function output anything too.
php artisan list
php artisan help migrate
Its not new project. I had been working on this project earlier and it was working fine. Created bunch of migration.
I tried deleting everying inside vendor and do composer install and composer update still no luck.
I did tried command like dump-autoload , optimize , clear-compiled etc. too
Thanks

Ok found the solution. I don't know whats the reason. But it was because I was using url() helper in a custom config file i created in config folder. The config file and value of url and others works fine all across the website but it just break artisan command. I don't know why.
Removing that url() helper from my custom config file solved the problem.

Normally when this issue arises it's due to an error in your code. Check for these coporates
Could be a typo in your .env file
Could be a syntax error in your .env
Entering in wrong configuration(syntax error) in your config folder

can you please try php artisan does that open up the artisan commands?
If these doesn't show anything then check your path to project in console.

Related

Call to undefined method Closure::__set_state() error on php artisan optimize [duplicate]

My code in on production and I ran
php artisan config:clear
After that, my code was not running. The index pages and all other pages went white screen and gave 500 internal server error in firebug. When I tried to run
php artisan
it gave me error as
PHP Fatal error: Call to undefined method Closure::__set_state() in /var/www/live/vendor/config.php on line 56
My code is in production!! /vendor/config.php file was not present before, what happened with that code??
Have you faced any such error?
I had given all permissions to storage/ folder and vendor/.
Any help/guide would be much appreciated.
I had similar issues when I ran php artisan config:cache. Apparently, it is an issue when the application is trying to load cached configuration files that have closures in it. It won't be fixed in Laravel since it is a bad practice to have closures in config files. Refer this Github issue
The way I solved this is by undo-ing this.
Delete the cache for config.
It is located in here
bootstrap/cache/config.php
OR
vendor/config.php
I had faced the similar issue in past don't know what caused it but as of now you can delete the config.php from /vendor it won't break your code.
And your code will be start working..
Among other root-causes, this error results from calling php artisan config:cache when a closure is defined inside any configuration file that Laravel attempts to load. Laravel does not allow for closures in configuration files; see:
https://github.com/laravel/framework/issues/9625
Deleting the resultant cache file, usually located at bootstrap/cache/config.php, "fixes" the error.
The long-term solution is to eliminate closures from all configuration files. The problematic config file can be determined by inspecting the offending line, as mentioned in the error message.
If the offending file is third-party, it is best to open an issue with the library, so that the issue is fixed upstream.
Here is what I did to solve it:
Go to /vendor/tymon/jwt-auth/src/config/config.php and replace the lines for storage and auth with:
'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter'
Go to /bootstrap/cache/config.php and delete it
Run the following commands in order:
A) php artisan config/cache
B) php artisan jwt:generate
C) php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
and that should do it!
Try to remove the config.php from bootstrap/cache folder. It worked for me.
Edit vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:108
and delete required.
Changing the config.php file inside the vendor/tymon/jwt-auth/src/config to this
'auth' => Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter::class`
and this
'storage' => Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter::class`
before runnning php artisan config:cache worked for me.
solved using
composer update
composer install

Laravel Deployment to Shared Hosting

Okay, I have not found a correct solution after searching many sources.
I am having a problem deploying laravel 5 project to a shared hosting.
I have followed every solutions out there but it didn't work.
The Problem I am getting is :
Where I have put my files :
I have put my laravel files outside the public_html with a new folder
called laravel
I have put public folder contains in domain.com/adminpanel
I am using default laravel .htaccess
I have changed .env according to my database but app_path is default as APP_PATH=http://localhost
I have used before uploading :
php artisan route:clear
php artisan view:clear
php artisan cache:clear
composer dump-autoload
I am still not clear how can it is trying to find in the
C:\\xampp\\htdocs
What I am doing wrong here?
Thanks in Advance !

php artisan serve [ErrorException] laravel

I recently inherited a project based on the laravel framework, which after I have set up, installed all requirements by composer and run php artisan migrations on, will not run via php artisan serve.
When I researched possible causes for this, I came across the following on SO:
laravel5: chdir(): No such file or directory (errno 2)
Using artisan serve after changing the public folder name
When I follow the suggested solution in the second one of adding the lines
'''
$app = new Illuminate\Foundation\Application(
realpath(DIR . '/../')
);
'''
to bootstrap/app.php I get the same exact error.
Is there a configuration file somewhere I need to update? Most of the suggested solutions I've found like changing files under vendor seem to be rather hacky? I'm really stuck on this and any help would be greatly appreciated - thanks!
check the configuration of your Homestead.yalm folder, there you can specity where your project is in the folders->map section.
It may the error from composer so try
Composer dump-autoload -o

php artisan [BadMethodCallException]

First of all I have just begun to tinker with Laravel 5 and php artisan, so don't judge to harsh please ;)
To get rid of ./public/index.php in the website path I did the following:
moved all the files in root/page_local/ folder;
moved files from public folder to root/page/;
modified the root/page_local/index.php file accordingly.
So the laravel works as it should now, but php-artisan is not. Every command that I try to run returns the same error:
[BadMethodCallException]
Method patter does not exist.
But I remember creating a Controller before and it worked, I tried multiple functions (--version, list, create::controller).
Even when I run composer update it errors when it tries to run php artisan clear-compiled.
I still managed to update the composer by running composer update --no-scripts
Please help me out on this one because I couldn't find any information regarding this issue on Laravel website and google. If you will need me to provide any of my code, let me know what you need and I will do so.
Thanks in advance.
Search your code for patter string, my guess is that you have a typo somewhere and the method is called pattern so use that instead. There is no patter method anywhere in Laravel code.

Laravel 5 on php artisan config:clear generated Closure::__set_state() error

My code in on production and I ran
php artisan config:clear
After that, my code was not running. The index pages and all other pages went white screen and gave 500 internal server error in firebug. When I tried to run
php artisan
it gave me error as
PHP Fatal error: Call to undefined method Closure::__set_state() in /var/www/live/vendor/config.php on line 56
My code is in production!! /vendor/config.php file was not present before, what happened with that code??
Have you faced any such error?
I had given all permissions to storage/ folder and vendor/.
Any help/guide would be much appreciated.
I had similar issues when I ran php artisan config:cache. Apparently, it is an issue when the application is trying to load cached configuration files that have closures in it. It won't be fixed in Laravel since it is a bad practice to have closures in config files. Refer this Github issue
The way I solved this is by undo-ing this.
Delete the cache for config.
It is located in here
bootstrap/cache/config.php
OR
vendor/config.php
I had faced the similar issue in past don't know what caused it but as of now you can delete the config.php from /vendor it won't break your code.
And your code will be start working..
Among other root-causes, this error results from calling php artisan config:cache when a closure is defined inside any configuration file that Laravel attempts to load. Laravel does not allow for closures in configuration files; see:
https://github.com/laravel/framework/issues/9625
Deleting the resultant cache file, usually located at bootstrap/cache/config.php, "fixes" the error.
The long-term solution is to eliminate closures from all configuration files. The problematic config file can be determined by inspecting the offending line, as mentioned in the error message.
If the offending file is third-party, it is best to open an issue with the library, so that the issue is fixed upstream.
Here is what I did to solve it:
Go to /vendor/tymon/jwt-auth/src/config/config.php and replace the lines for storage and auth with:
'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter'
Go to /bootstrap/cache/config.php and delete it
Run the following commands in order:
A) php artisan config/cache
B) php artisan jwt:generate
C) php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
and that should do it!
Try to remove the config.php from bootstrap/cache folder. It worked for me.
Edit vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:108
and delete required.
Changing the config.php file inside the vendor/tymon/jwt-auth/src/config to this
'auth' => Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter::class`
and this
'storage' => Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter::class`
before runnning php artisan config:cache worked for me.
solved using
composer update
composer install

Categories