Moving laravel project to another directory - windows

I just installed laravel. I use Windows Xampp.
Currently I installed it in c:\users\user_name\laravel.
Is that correct or should I put it in htdocs?
If so how to do it?
thanks for your help

Cut paste you laravel project in path to xampp\htdocs . set root folder of xampp to xampp\htdocs\laravel\public

Thanks to syam who helped me to start finding a fix to my problem.
Here is my solution
Move laravel project to htdocs
Change the env configuration DB_DATABASE=your_db_name DB_USERNAME=user_name DB_PASSWORD=user_password
Edit AppServiceProvider.php and add this code
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
Then in command line move the active directory to your laravel project and execute this code
composer install
php artisan key:generate
php artisan cache:clear
php artisan migrate

On moving laravel project to another directory:
To clear cache, sometimes permission problem may occur. Do this serially:
change env values then,
php artisan key:generate
php artisan config:clear
php artisan cache:clear
php artisan migrate

Related

How to upload Laravel Project to subdomain without database?

I am upload project file to Sub Domain. But In web site,just project files is showing. Project is not execute. How can i resolve this problem ?
Subdomain is active.
Your hosting and configuration should have the ff:
Appropriate PHP version compatible to your Laravel project.
Composer and Laravel installed.
Proper web server configuration for Apache, Nginx, Litespeed, etc. This is most likely where your problem is, where you should only expose the /public folder as the only public directory of your page.
I installed composer and I add .env file the run some commands like
php artisan key:generate
php artisan clear-compiled
php artisan cache:clear
php artisan config:clear
php artisan optimize
php artisan route:cache
Then resolved problem.

file_put_contents(C:\xampp\htdocs\instant\storage\framework/sessions/FF): failed to open stream: No such file or directory

I was trying to upload this instance on Amazon elasticBeanstalk, but it doesn't seem to work.
I have tried using ssh to access the files to no avail.
i did php artisan config:cache and composer dump-autoload before uploading.
Any help is appreciated.
Go to directory laravel/bootstrap/cache and delete config.php file.
Open terminal in your project directory and run this cmd:
php artisan config:clear
How did I solve this issue? After running those commands and not getting the solution.
composer dump-autoload
composer install
php artisan cache:clear
php artisan config:clear
php artisan optimize
php artisan clear-compiled
The issue was simple. In my case under storage/framework there is sessions folder is missing so I created the directory and run the command again. And issue solved.
**Note: In some cases if your run php artisan cache:clear and php artisan config:clear. Your issue will be solved.
Hope this thread will solve your issue.
Happy Coding :)
Can try using php artisan optimize. This will clear everything that cache your projects.
Let me know if this help you guys. Thanks!
run php artisan vendor:publish
Asking Which provider or tag's files would you like to publish?:
Type 0
Then run php artisan serve
This command work in my case: php artisan config: clear
It worked for me when i changed all paths in C:\xampp\htdocs...\bootstrap\cache\config.php

There is no existing directory at /storage/logs and its not buildable: Permission denied

I have a problem with my Laravel deployment on a OVH web server.
After made
composer update
php artisan cache:clear
php artisan route:clear
php artisan dump-autoload
I have this answer:
There is no existing directory at /storage/logs and its not buildable: Permission denied
I put all the files on 777 chmod but I have always this answer.
Please try the following commands
php artisan route:clear
php artisan config:clear
php artisan cache:clear
Note: In case you are a Homestead & VirtualBox user, please be sure that your VirtualBox is up to date.
It helped in this thread at laracasts
Clear the cache and config, then deploy to the live server.
If you've already uploaded to the live server, then you have to follow these steps:
Delete bootstrap/cache/config.php
Delete all log files in storage/logs.
You don't need to add any permission on the storage file.
The main problem here is in the compiled file, and due to which laravel try to show an error.
By default in laravel, storage file not having permission to show in the console (error
shows from the error.log file).
So the thing you need to fix is to fix compile file. which can be done thought this single command
Use this
php artisan optimize:clear
This command will clear all your cache
Compiled views
Application cache
Route cache
Configuration cache
After changing local conf i got the same error over and over,
try this, probably will help.
rm bootstrap/cache/config.php
and then
php artisan cache:clear
depending on your scenario, reloading auto-loader file can solve your issue, for that use :
composer dump-autoload
or sometimes just try :
composer install
this do the two the commands listed above.
go to your vagrant
then run
vagrant ssh
php artisan config:cache
Run the following command if you can access your server terminal
php artisan route:clear && php artisan cache:clear && php artisan config:clear && php artisan config:cache
If you are on shared hosting and cant access the terminal go to your web route file in routes/web.php and make a temporary link such as shown:
Route::get('reset', function (){
Artisan::call('route:clear');
Artisan::call('cache:clear');
Artisan::call('config:clear');
Artisan::call('config:cache');
});
Then go to http://your-domain/reset to execute the commands. there after you can now access your website as normal
If you are using homestead (vagrant) in Laravel then follow the steps #Farid shahidi provided
vagrant ssh
cd /home/vagrant/code <-- your file usually resides here; see your Homestead.yaml configuration
php artisan config:cache
You Have to try artisan command in this way
php artisan cache: clear
php artisan config:cache
php artisan cache: clear
This one-line command solves my issue:
php artisan config:cache
Delete bootstrap/cache/config.php from your laravel deployment on the server.
Please run the below commands:
php artisan route:clear
php artisan config:clear
php artisan cache:clear
This one worked for me in case your project is located within /var/www/html/
sudo chmod -Rf 0777 /var/www/html/{project-name}/bootstrap/cache
sudo chmod -Rf 0777 /var/www/html/{project-name}/storage
You need to run this command from the terminal.
php artisan config:clear
php artisan config:cache
I got the same issue, I change the permissions of the folders inside the the storage folder.
chmod 777 <folder_name>
I'm not sure about this security wise. but this resolve my problem.
I change my file settings to 755 also work for me.
try this
remove your "vendor" folder
Run "composer install" or "composer install --ignore-platform-reqs" on your cmd or terminal
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan config:cache
if you are using linux:
service apache2 restart (just in case)
if you using xammp:
just restart your xammp
For those of you using sail, do:
sail artisan optimize:clear

Laravel 5.4 RuntimeException] Directory name must not be empty

I'm just learning Laravel 5 and I am loving it.
I have an issue though, my php artisan command just stopped working all of a sudden. It shows this error
[RuntimeException]
Directory name must not be empty.
I am running on a windows10 pc . Thanks
Today I got the same issue while working on local environment, I really don't know how but my config folder was deleted automatically. Fortunately, I had backup with me and I simply re-add the config folder into my project and my site is back.
I think you need to update your composer like:
composer update
OR
composer update --no-scripts
after you can clear the cache
php artisan config:cache
php artisan config:clear
php artisan cache:clear

There are no commands defined in the "passport" namespace. When installing API Authentication In laravel

I am getting below error when i run
php artisan passport:install
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "passport" namespace.
For installing laravel passport make sure you add this line to config/app.php in the providers array (package service providers section):
Laravel\Passport\PassportServiceProvider::class,
Then install the package and migrate the database
composer require laravel/passport
php artisan migrate
php artisan passport:install
Clearing out the cache is generally helpful first step when commands are not working, especially when you update anything in the config folder on .env files.
php artisan config:clear
php artisan config:cache
Config clear removes the configuration cache file. Config cache creates a new configuration cache file with the current settings. Config cache enables faster load times for your apps!
I got solution. After running following two commands every thing work fine.
run php artisan cache:clear
run php artisan config:cach
I was searching for a solution for this and I found simple one that worked for me:
Add these lines to $commands array in app/Console/Kernel.php
\Laravel\Passport\Console\InstallCommand::class,
\Laravel\Passport\Console\KeysCommand::class,
\Laravel\Passport\Console\ClientCommand::class,
Try running composer require laravel/passport "~9.0" before running php artisan passport:install
Just follow these steps:
composer require laravel/passport.
Once the installation finishes, add the following provider in the config/app.php file: Laravel\Passport\PassportServiceProvider::class,
php artisan migrate
php artisan passport:install
Here Is the solution of install Laravel passport with mongodb:
Just replace the Illuminate\Database\Eloquent\Model; with Jenssegers\Mongodb\Eloquent\Model in below files:
..\vendor\laravel\passport\src\Token.php,
..\vendor\laravel\passport\src\AuthCode.php
..\vendor\laravel\passport\src\Client.php
..\vendor\laravel\passport\src\PersonalAccessClient.php
and protected $table= "Table_name" variable with protected $collection="Table_name"

Resources