While pushing homestead repo to live server, i encountered the following error.
I can confirm that i can connect to mysql from the command line using the variables set in the .env file.
I know that it has something to do with this particular setup, as i am effectively operating a similar laravel 5.1 project on the same host.
I noticed that on the error page that i was looking at the top message, which was 3/3. Looking to the 1/3 (the first error) error helped me find the solution.
Laravel was still using the homestead credentials.
i found this by searching:
grep -r "homestead" .
returns
./bootstrap/cache/config.php: 'database' => 'homestead',
To clear the cache all that was left was to do was clear the cache.
php artisan config:cache
Related
I cvurrently have a laravel application running on heroku, the issue here is, I keep getting the error that I can't connect to the database: SQLSTATE[HY000] [1045] Access denied for user 'user'#'ec2-54-74-209-179.eu-west-1.compute.amazonaws.com' (using password: YES). Now the host is wrong here, the environment files are TOTALLY different (except for the username) then what the error gives....
How can I resolve this issue?
I've tried to use the DB_URL env, but that gives the same result...
Did you set the .env correctly on what's running on their server?
You can see all your projects in laravel at TOOLS->DEPLOYEMNT->CONFIGURATIONS
add all the info and connect to the remote project. I did the same and changed the .env directly there.
and of course you have to clean all the cache cause even if you change the .env it will not work until you'll clear it
php artisan cache:clear;
php artisan config:clear;
php artisan route:clear;
Obviously this need to be executed on the project on heroku or aws (as it appears from the Error)
I have everything correct, as written at laravel/algolia websites.
I tried to read lot of documentations and tutorials about Laravel Scout installation, but still can't find solution.
I have everything correct in my settings and also APIs are correct but still getting this error:
Impossible to connect, please check your Algolia Application Id.
I had the same issue (with Windows 10) and found this exception in the stack trace:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I found the solution for the error above in another StackOverflow post:
1) Download the latest cacert.pem from
https://curl.haxx.se/ca/cacert.pem
2) Add the following line to php.ini (if this is shared hosting and
you don't have access to php.ini then you could add this to .user.ini
in public_html)
curl.cainfo="/path/to/downloaded/cacert.pem"
Make sure you enclose the path within double quotation marks!!!
It solved my problem, Laravel Scout is working fine after that. Hope this will help someone.
Apparently on the issue came from on wrong credentials, this can occurs providing the wrong Application ID or Admin API Key. Also the correct way to provide the credential on scout.php is :
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', '')
],
And then fill your credentials in your .env file.
I'd recommend you to run php artisan config:clear in case you have cached your configuration (which you shouldn't do in dev env).
Let us know if it solve your issue.
I had the same issue and solved it like this
php artisan cache:clear
php artisan route:clear
php artisan config:clear or config:cache
My assumption is, because Laravel always creates a cache in the config, every time we change some config, there must be another config that is broken or an error due to the cache that was created earlier.
But I don't know for sure.
I share with you my experience.
System was Vagrant Homestead with VirtualBox in Windows 10.
command used in CMD:
php artisan scout:import "App\Post"
command failed with:
Impossible to connect, please check your Algolia Application Id.
Logged into virtual box with vagrant ssh and gave it another try.
That solved my problem.
That's my first post - I hope my problem explanation will be easy to understand. I just started with Laravel5.
I want to retrive data from mysql database that was successfully created using migrations. I'm following laracast series. I created route, controller and view to display the data. Unfortunatelly, when I enter browser to see it, I constantly get this error:
`SQLSTATE[HY000] [1698] Access denied for user 'root'#'localhost'`
enter image description here
My .env and database.php files are configured. Also, I can do migrations with no error (and I see result in phpmyadmin to which I can log in). When I type php artisan tinker, I can do various operations on my databases. The problem arises only when I want to display data in my laravel site.
I did vast research of the problem and tried numerus tips like:
1.change local host to 127.0.0.1
2.change my database login and pass for homeostead, secret
3.I did
`GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost' IDENTIFIED BY 'Your_Password';`
When I type mysql --user=root -p I can log in but command show databases acts like never ending and shows nothing.
and other ...
Now, I'm at loss for ideas what to do next, please help me. I will appreciate that a lot cos I'm really stucked at this point!
my .env file:
`DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=haslo`
I use homeostead and Laravel 5 on Windows 7
Server type: MySQL5.7.15
PHP version: 7.1
Apache/2.4.23, PHP/7.1
have a look at my answer at Unable to connect to local MySQL DB using Laravel
That could be the answer for you as well.
If you use homestead with vagrant, then laravel will be lunched inside vagrant and 127.0.0.1,3306 will mean the mysql inside vagrant, type vagrant ssh and check for the database.
Try this command:
Php artisan config:clear
Sometimes I can't run php artisan migrate if I'm using mamp. It yield this error:
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
Why would this be happening?
Sometimes you have to exclusively tell Laravel where the unix_socket location. In case of Mamp, you should add this line to your mysql config:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
If you are using xampp, the location would be C:/xampp/xamppfiles/var/mysql/mysql.sock.
To get path to your active socket file, try login to your mysql server and run status command.
I'm having some trouble getting Laravel to connect to my database, when using a custom Artisan command.
I can post my command but I'll skip to my db settings as I suspect that is what is wrong. In start.php I have:
$env = $app->detectEnvironment(array(
'local' => array('homestead'),
));
and then I have no local/database.php files in my config. Instead I have a .env.local.php which works great for everything except this. All database settings are set as 'DB_NAME => getenv('DB_NAME'); etc.
When I run php artisan custom:command I get the following:
[Illuminate\Database\QueryException]
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: select * from `users` where `paused_until` = 3)
Then if I run
php artisan fdb:reactivate-paused --env=local
I seem to get much closer but still get:
Access denied for user 'homestead'#'localhost' (using password: YES)
Is it that Laravel doesn't know to use the .env.local.php file when I am running commands in the terminal? All my migrate and db:seed queries seem to work fine. Can anyone point me in the right direction?
Looking at it again this morning, I must have been 100% burnt out. I was running the command from my Local Machine, not the Homestead VM.