**I can't move files to '/' path and in htdocs this project don't read env file if i set key in app.php then can't load sql parameters from env , how to set?**
Sorry for my eng
You need to run the following command in order to create the correct encryption keys:
php artisan key:generate
This will fix your 'The only supported chiphers are AES-128-CBC ...' error.
You also need to edit your virtual host to make your the public directory the DocumentRoot cause now you are listing your application root and that is not good!
Related
After creating a few duplicate snipe it installations I think it's better to move installed composer packages to a global location (so I won't have to download/install them each time I create a new snipe it instance). How and where should I put these ? Already moved composer to /usr/local/bin . Ultimate goal is to remove the packages from the vendor subfolders and load them from global location. What would need to be changed in the snipe it folders ?
Thanks
Running Ubuntu server 20.04
What I did was:
copy site1 to site2
create db for site2
add extra ip in apache ports.conf to listen on
add ip in netplan yaml file
create new ssl key for extra ip
created conf for site2 in sites-available + a2ensite
modified .env for url app key en db settings
My main problem is that php artisan key:generate throws an error when in root of site2. Was able to generate app key with echo "base64:$(openssl rand -base64 32)" and site2 works as it shoulds for now.
In Laravel 6 Documentation second paragraph of Application Key written like this
Typically, this string should be 32 characters long. The key can be
set in the .env environment file. If you have not renamed the
.env.example file to .env, you should do that now. If the application
key is not set, your user sessions and other encrypted data will not
be secure!
Why did they ask to rename it? I also found this paragraph in the Laravel older version. Is there any difference between those since they have the same content but different name?
If you've install Laravel using composer command.
composer create-project laravel/laravel projectname
you don't need renamed the .env.example file to .env. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command.
If you clone project using git clone some folder is ignored by git so you might not get env file as well as vendor folder. Therefore, they will have to manually enter php artisan key:generate for their app to function correctly.
More info SO answer
Laravel need to use .env file to define a database connection, some general setting like application key as well. So if you have no .env file, your Laravel has not a setting for now.
Like they said, If the application key is not set, your user sessions and other encrypted data will not be secure! You need to create / copy /remove the .env.example to the new .env for this reason. for letting our Laravel knows about general config.
By the way, do not use the .env.example like copy-and-paste because it's an example. you need to change the value config to your own.
The simplest way is move it on your server with Filezilla or another FTP program. Rename file, and re-download it on your computer. It works for me last time :)
The .env.example the file is just an example of the .env file. It is not used by the app. It is used to serve as a base for you to edit and rename.
In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.
SOLVED: My machine didn't have MySQL installed and was having a hard time installing it and I still do.
I recently downloaded a Laravel project from cPanel and I wish to work on it. But when I try to run the project I get "500 server error".
After searching on Google, I tried the following steps
composer update --no-scripts
php artisan key:generate
php artisan migrate
This does not seem to be doing anything. How do I run the project on my local machine that I downloaded from the cPanel?
You may want to see what that error is in the log file:
Log file location:
/storage/logs/laravel.log`
The laravel.log file mentioned above may have a date with it on the name.
The 500 error is because the stack trace is turned off in the .env file with APP_DEBUG=falsewhich may be by design since it's on a live server.
Download the files in "public_html" folder and project folder(in my case it is "LMS" folder - refer screenshot).
Export the database from phpmyadmin in cPanel which is used in Laravel project
Go inside the Project folder(in my case LMS folder) and delete all the content inside the "public" folder. Then you will have an empty public folder inside your project folder(LMS folder)
Now copy and paste all the content inside "public_html" folder that is downloaded from cPanel into the previously emptied "public" folder inside the project folder(LMS)
Import the exported database to locally created database
Change following lines in index.php file which is inside the local "public" folder
These two lines
require __DIR__.'/../LMS/vendor/autoload.php';
$app = require_once __DIR__.'/../LMS/bootstrap/app.php';
into these two
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
Notice that we have removed the "LMS" in the paths
Go to the .env file in the project root and change these settings that matches to your local environment
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lms_trends_new
DB_USERNAME=root
DB_PASSWORD=root
//Only for MAMP users
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
Run following commands
$ php artisan config:cache
$ composer dump-autoload
Finally run your project with following command
php artisan serve
First , Download the database from cpanel which is used in laravel project .
Then follow any one step below .
Upload the database in your localhost mysql .
then Change your env files as per your local system .
Install composer using following command .
composer install
Then update the compsoser From your composer.json file .
Composer update
composer dump-autoload
Now run php artisan serve
If you find any difficult in the first step , follow the second one.
Install new laravel project using following command .
`composer global require laravel/installer`
Create new project Laravel
`laravel new projectname`
Then just copy paste the directories app/ , Resources, /Public , /config .
Do not touch anything inside config/config.php
Just change the database name and username, password in .env file ..
Then run
php artisan serve
If you still cant able to do it , comment here
Today I tried uploading my first website,but i'm getting an error.On the local server it works fine but when I uploaded it to the live server,i'm getting an error that is saying "Whoops, looks like something went wrong".To be more specific it's showing twice on the same page.Check the image bellow.
Steps followed while uploading project to live server:
Zipped the file
Created a new folder at the root directory.
Unzipped the file in the new folder.
Moved all the files from public folder to /public_html/
Edited the locations on the index.php file.
Note: Other than index.php I haven't altered any other file.
I followed a lesson on youtube and with these steps, his project worked but mine is throwing an error.
I have also noticed that after unzipping the folder in the cpanel the .env file is missing.Could this be the issue?
Make the .env file is there .
Then don't forget to generate the application key
php artisan key:generate
There are some times that the .env file isn't being read by the server. You may try to edit the .env file and supply the necessary credentials according to your server such as the following:
APP_URL= *
APP_KEY= *
DB_CONNECTION=mysql
DB_HOST= *
DB_PORT=3306
DB_DATABASE= *
DB_USERNAME= *
DB_PASSWORD= *
The lines with the asterisks are the ones you typically need to fill up. The APP_KEY can be set by using the php artisan key:generate command in your local workspace, then copy the value to your live server.
If the .env can't be read and it still shows an error, try to edit the config/app.php file and change 'key' => env('APP_KEY'), into 'key' => yourgeneratedkey,. Try to also change the values in your config/database.php file into the same one as your .env file
Follow the installation guide https://laravel.com/docs/5.6
Check the server requirements(check if all the required extensions are installed).
Check if all the files are there.
Check Configurations
check config.php file
check directory permissions.
generate application key (php artisan key:generate)
Check if .env exists or not
thanks to all of you who replied.I found the solution.It turns out the cause for the error was a simple spelling mistake in my .env file.
This is caused by missing ".env" file, copy the content of ".env.example" file and create a new ".env" file in the same directory as your "example.env" file.
then run: php artisan key:generate
I uploaded all laravel project on server, its working fine on local but getting error on server, even database configuration and key is configured in env. file. even i renamed .env.example file as .env too but got same error.
Error is
"Whoops, looks like something went wrong."
my error log is here:
[2017-11-06 15:19:07] local.ERROR: exception 'RuntimeException' with
message 'The only supported ciphers are AES-128-CBC and AES-256-CBC
with the correct key lengths.' in
/home/rndspot5/public_html/dev/lea/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:43
Judging from your error, you need to run php artisan key:generate this will update your key of which in turn will rectify your error.
You will need to either SSH into your public_html folder if you have host permission to do so. Alternatively, you can ask your host provider to either:
Grant you SSH access
Perform this action for you.
You can then run: php artisan config:clear once the new key has been generated.
If you are on shared hosting you can use these steps
Open your .env file, copy APP_KEY to somewhere else as a backup
Run php artisan key:generate from console
Copy the new APP_KEY and upload it to the .env file on your (shared) server
Move the old key back to development
I resolved this issue, by adding web app url in .env and Config/App.php and now its working :) thanks all of you for sharing such a value able knowledge that will help me, may be later.