Laravel Deployment to Shared Hosting - php

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 !

Related

Created a project in laravel but I can't access a welcome page

I installed Laravel (in W10/Wamp3.3/PHP5.6) using Composer and created a new project with the following command:
laravel new my_project
Project doesn't have a welcome page, opens file-list directly. So I decided to try my chance on creating a new controller and create a route.
php artisan make:controller Hello
And my route in routes/web
Route::get('/hello', 'HelloController#index');
I also cleared the route cache:
php artisan route:clear
Created the controller with no methods. myproject/hello shows nothing.
What am I missing? File permissions or wamp based problem?
There's a question related with this but it's more like a server problem.
Few causes for this that I've run into. Most likely one is going to be the server pointing to the incorrect directory. What I would do to test is run php artisan serve from the root of the project. This will open up a server pointing to public directory. If this functions correctly then you have confirmation.

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

Issue with key (cipher error) when changing laravel folder structure

I am changing laravel 5.3 folder structure. What I exactly do is basically move all the content from public folder to root folder, and then all the other files besides public folder to the new created folder - project. Then I update the require paths in index.php, and when I try to run the project via XAMPP, I'm getting this error.
I am pretty sure that the key is set correctly, because I haven't changed anything else but the folder structure and paths, and the project worked before this folder structure change. It seems to me that program can't locate the .env file.
Try running
php artisan config:clear
and
php artisan key:generate
I followed this post

laravel : php artisan not working

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.

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