summaryrefslogtreecommitdiff
path: root/www/posts/laravel
diff options
context:
space:
mode:
Diffstat (limited to 'www/posts/laravel')
-rw-r--r--www/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html33
-rw-r--r--www/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/index.html27
-rw-r--r--www/posts/laravel/atom.xml54
-rw-r--r--www/posts/laravel/index.html7
4 files changed, 68 insertions, 53 deletions
diff --git a/www/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html b/www/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html
index 0cb27d1..88ed736 100644
--- a/www/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html
+++ b/www/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html
@@ -5,6 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed</title>
<link rel="shortcut icon" href="/images/favicon.png">
+ <link rel="stylesheet" href="/css/modern-normalize.min.css">
+ <link rel="stylesheet" href="/css/highlight.min.css">
+ <link rel="stylesheet" href="/css/railscasts.css">
<link rel="stylesheet" href="/css/site.css">
<link href="/posts/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts"/>
<link href="/posts/arch/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts About Arch"/>
@@ -22,21 +25,23 @@
Illuminate\Database\QueryException
-SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = testsite and table_name = migrations and table_type = 'BASE TABLE')
+ SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = testsite and table_name = migrations and table_type = 'BASE TABLE')
-at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
-674▕ // If an exception occurs when attempting to run a query, we'll format the error
-675▕ // message to include the bindings with SQL, which will make this exception a
-676▕ // lot more helpful to the developer instead of just the database's errors.
-677▕ catch (Exception $e) {
-678▕ throw new QueryException(
-679▕ $query, $this-&gt;prepareBindings($bindings), $e
-680▕ );
-681▕ }
-682▕
+ at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
+ 674▕ // If an exception occurs when attempting to run a query, we'll format the error
+ 675▕ // message to include the bindings with SQL, which will make this exception a
+ 676▕ // lot more helpful to the developer instead of just the database's errors.
+ 677▕ catch (Exception $e) {
+ 678▕ throw new QueryException(
+ 679▕ $query, $this-&gt;prepareBindings($bindings), $e
+ 680▕ );
+ 681▕ }
+ 682▕
-+33 vendor frames
-34 artisan:37
-Illuminate\Foundation\Console\Kernel::handle()</code></pre><p>The cause of this issue is due to a change introduced to the .env.example file. This changed the environment variable DB_HOST from 127.0.0.1 to mysql. The reason for this change is to support [Laravel Sail](https://laravel.com/docs/8.x/sail) which is a Docker development environment for Laravel.</p><p>The change means your Laravel application will try and connect to a database server with the hostname of mysql. Unless this exists then the application can't connect.</p><p>To resolve the issue just change the value back to 127.0.0.1</p><pre><code class="shell">DB_HOST=127.0.0.1</code></pre><h3>Links</h3><a href="https://github.com/laravel/laravel/commit/a895748980b3e055ffcb68b6bc1c2e5fad6ecb08#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8cL11">Commit that changed .env.example.</a><a href="https://laravel.com/docs/8.x/sail/">Laravel Sail</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ +33 vendor frames
+ 34 artisan:37
+ Illuminate\Foundation\Console\Kernel::handle()</code></pre><p>The cause of this issue is due to a change introduced to the .env.example file. This changed the environment variable DB_HOST from 127.0.0.1 to mysql. The reason for this change is to support [Laravel Sail](https://laravel.com/docs/8.x/sail) which is a Docker development environment for Laravel.</p><p>The change means your Laravel application will try and connect to a database server with the hostname of mysql. Unless this exists then the application can't connect.</p><p>To resolve the issue just change the value back to 127.0.0.1</p><pre><code class="shell">DB_HOST=127.0.0.1</code></pre><h3>Links</h3><a href="https://github.com/laravel/laravel/commit/a895748980b3e055ffcb68b6bc1c2e5fad6ecb08#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8cL11">Commit that changed .env.example.</a><a href="https://laravel.com/docs/8.x/sail/">Laravel Sail</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ <script src="/js/highlight.min.js"></script>
+ <script src="/js/site.js"></script>
</body>
</html>
diff --git a/www/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/index.html b/www/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/index.html
index f85bf66..7bc316e 100644
--- a/www/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/index.html
+++ b/www/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/index.html
@@ -5,6 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Installing Laravel Homestead in Arch Linux</title>
<link rel="shortcut icon" href="/images/favicon.png">
+ <link rel="stylesheet" href="/css/modern-normalize.min.css">
+ <link rel="stylesheet" href="/css/highlight.min.css">
+ <link rel="stylesheet" href="/css/railscasts.css">
<link rel="stylesheet" href="/css/site.css">
<link href="/posts/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts"/>
<link href="/posts/arch/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts About Arch"/>
@@ -24,22 +27,22 @@ $ git checkout release</code></pre><p>Create the Homestead.yaml file by using th
$ echo &quot;&lt;?php phpinfo();&quot; &gt; ~/projects/testsite/public/index.php</code></pre><h3>Setting up SSH</h3><p>I like to use unique ssh keys for servers that I connect to and that includes any virtual machines running on my local machine. The ssh-keygen command generates a new key that I store in a directory separate from my other ones.</p><pre><code class="shell">$ mkdir ~/.ssh/homestead
-$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/homestead/id_rsa</code></pre><h3>Hostname Resolution</h3><p>Since I am using one instance of Homestead for multiple sites I need to configure the host machine so that requests are directed to the correct site on the virtual machine. This is done by adding an entry into the /etc/hosts file for each site.</p><p>First I need to know the IP address of the virtual machine. This can be done by looking in the Homestead.yaml file for the ip entry.</p><pre><code class="yaml">ip: &quot;192.168.10.10&quot;</code></pre><p>Then for each site that will be hosted on the virtual machine add it's domain and ip to the /etc/hosts file.</p><pre><code class="shell">$ sudo nvim /etc/hosts</code></pre><pre><code class="shell">192.168.10.10 testsite.local</code></pre><h2>Configuring Homestead</h2><p>Homestead is configured by editing the Homestead.yaml file that was created with the init.sh command earlier.</p><pre><code class="shell">$ cd ~/.local/share/homestead
+$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/homestead/id_rsa</code></pre><h3>Hostname Resolution</h3><p>Since I am using one instance of Homestead for multiple sites I need to configure the host machine so that requests are directed to the correct site on the virtual machine. This is done by adding an entry into the /etc/hosts file for each site. </p><p>First I need to know the IP address of the virtual machine. This can be done by looking in the Homestead.yaml file for the ip entry.</p><pre><code class="yaml">ip: &quot;192.168.10.10&quot;</code></pre><p>Then for each site that will be hosted on the virtual machine add it's domain and ip to the /etc/hosts file. </p><pre><code class="shell">$ sudo nvim /etc/hosts</code></pre><pre><code class="shell">192.168.10.10 testsite.local</code></pre><h2>Configuring Homestead</h2><p>Homestead is configured by editing the Homestead.yaml file that was created with the init.sh command earlier.</p><pre><code class="shell">$ cd ~/.local/share/homestead
$ nvim Homestead.yaml</code></pre><p>First tell Vagrant that Virtualbox will be providing the virtual machine.</p><pre><code class="yaml">set provider: virtualbox</code></pre><p>Vagrant needs to setup the ssh keys between the host and the guest so that you can connect via ssh. Enter the path to the one created earlier.</p><pre><code class="yaml">authorize: ~/.ssh/homestead/id_rsa.pub
keys:
-- ~/.ssh/homestead/id_rsa</code></pre><p>Share the project folder with the virtual machine. This setting will make the directory /home/vagrant/projects/testsite available in the virtual machine. The contents of this directory will be shared with the host machine directory ~/projects/testsite.</p><pre><code class="yaml">folders:
-- map: ~/projects/testsite
-to: /home/vagrant/projects/testsite</code></pre><p>Setup Homestead so that it can serve the application through the 'domain' testsite.local. Note how this matches the name added to /etc/hosts earlier.</p><pre><code class="yaml">sites:
-- map: testsite.local
-to: /home/vagrant/projects/testsite/public</code></pre><p>Have Homestead create a database for our application.</p><pre><code class="yaml">databases:
-- testsite</code></pre><p>Since I'm using a database ensure that a database server is installed on the virtual machine.</p><pre><code class="yaml">features:
-- mariadb: true</code></pre><h2>Launching Homestead</h2><p>Homestead is started with the vagrant up command. It may take a while for Homestead to launch if this is the first time running this command as Vagrant has to first download the actual virtual machine file.</p><pre><code class="shell">$ cd ~/.local/share/homestead
+ - ~/.ssh/homestead/id_rsa</code></pre><p>Share the project folder with the virtual machine. This setting will make the directory /home/vagrant/projects/testsite available in the virtual machine. The contents of this directory will be shared with the host machine directory ~/projects/testsite.</p><pre><code class="yaml">folders:
+ - map: ~/projects/testsite
+ to: /home/vagrant/projects/testsite</code></pre><p>Setup Homestead so that it can serve the application through the 'domain' testsite.local. Note how this matches the name added to /etc/hosts earlier.</p><pre><code class="yaml">sites:
+ - map: testsite.local
+ to: /home/vagrant/projects/testsite/public</code></pre><p>Have Homestead create a database for our application.</p><pre><code class="yaml">databases:
+ - testsite</code></pre><p>Since I'm using a database ensure that a database server is installed on the virtual machine.</p><pre><code class="yaml">features:
+ - mariadb: true</code></pre><h2>Launching Homestead</h2><p>Homestead is started with the vagrant up command. It may take a while for Homestead to launch if this is the first time running this command as Vagrant has to first download the actual virtual machine file.</p><pre><code class="shell">$ cd ~/.local/share/homestead
$ vagrant up</code></pre><p>Once the machine is booted I can browse to http://testsite.local/ to see the simple site that is now served by Homestead.</p><h2>Installing a Laravel Site</h2><p>Now that Homestead is installed and serving a simple site its time to move onto installing the first Laravel application. Since Homestead provides all the tools required to do this the first thing to do is connect to the virtual machine.</p><pre><code class="shell">$ cd ~/.local/share/homestead
-$ vagrant ssh</code></pre><p>Once connected to the virtual machine navigate to the project folder of the site. Remember that this is the folder that is also been shared with the host machine.</p><pre><code class="shell">$ cd ~/projects/testsite</code></pre><p>Clear the contents of this folder otherwise composer will complain about a non-empty directory.</p><pre><code class="shell">$ rm -rf public</code></pre><p>Use composer to install a Laravel project.</p><pre><code class="shell">$ composer create-project laravel/laravel .</code></pre><h2>Setting Up The Application Database</h2><p>Once Larvel is installed a database needs to be created for the application. Connect to the database server with the mysql command.</p><pre><code class="shell">$ mysql -uhomestead -psecret</code></pre><p>Check that the application's database was created when the virtual machine was first booted.</p><pre><code class="mysql">SHOW DATABASES;
+$ vagrant ssh</code></pre><p>Once connected to the virtual machine navigate to the project folder of the site. Remember that this is the folder that is also been shared with the host machine.</p><pre><code class="shell">$ cd ~/projects/testsite</code></pre><p>Clear the contents of this folder otherwise composer will complain about a non-empty directory.</p><pre><code class="shell ">$ rm -rf public</code></pre><p>Use composer to install a Laravel project.</p><pre><code class="shell">$ composer create-project laravel/laravel .</code></pre><h2>Setting Up The Application Database</h2><p>Once Larvel is installed a database needs to be created for the application. Connect to the database server with the mysql command.</p><pre><code class="shell">$ mysql -uhomestead -psecret</code></pre><p>Check that the application's database was created when the virtual machine was first booted.</p><pre><code class="mysql">SHOW DATABASES;
+--------------------+
| Database |
@@ -69,7 +72,9 @@ DB_PORT=3306
DB_DATABASE=testsite
DB_USERNAME=testsite
DB_PASSWORD=testsite</pre><p>Now when you browse to http://testsite.local you will see the Laravel welcome page.</p><h2>Simplified SSH</h2><p>I prefer to just use the host system's ssh command to connect to Homestead as it cuts out having to navigate to the Homestead directory and running vagrant ssh.</p><p>To simplify ssh I first add a hostname for the virtual machine to the file /etc/hosts/</p><pre><code class="shell">192.168.10.10 homestead</code></pre><p>I then edit ~/.ssh/config and add the below configuration. This tells ssh to automatically use the keys and username specified when connecting to the virtual machine.</p><pre><code class="ssh">Host homestead
-IdentityFile ~/.ssh/homestead/id_rsa
-User vagrant</code></pre><p>From now on I can simply do ssh homestead from any directory to connect to the Homestead virtual machine.</p><h3>Links</h3><a href="https://laravel.com/docs/8.x/homestead/">Laravel Homestead</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ IdentityFile ~/.ssh/homestead/id_rsa
+ User vagrant</code></pre><p>From now on I can simply do ssh homestead from any directory to connect to the Homestead virtual machine.</p><h3>Links</h3><a href="https://laravel.com/docs/8.x/homestead/">Laravel Homestead</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ <script src="/js/highlight.min.js"></script>
+ <script src="/js/site.js"></script>
</body>
</html>
diff --git a/www/posts/laravel/atom.xml b/www/posts/laravel/atom.xml
index 1bc5601..621f985 100644
--- a/www/posts/laravel/atom.xml
+++ b/www/posts/laravel/atom.xml
@@ -18,22 +18,22 @@ $ git checkout release</code></pre><p>Create the Homestead.yaml file by using th
$ echo &quot;&lt;?php phpinfo();&quot; &gt; ~/projects/testsite/public/index.php</code></pre><h3>Setting up SSH</h3><p>I like to use unique ssh keys for servers that I connect to and that includes any virtual machines running on my local machine. The ssh-keygen command generates a new key that I store in a directory separate from my other ones.</p><pre><code class="shell">$ mkdir ~/.ssh/homestead
-$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/homestead/id_rsa</code></pre><h3>Hostname Resolution</h3><p>Since I am using one instance of Homestead for multiple sites I need to configure the host machine so that requests are directed to the correct site on the virtual machine. This is done by adding an entry into the /etc/hosts file for each site.</p><p>First I need to know the IP address of the virtual machine. This can be done by looking in the Homestead.yaml file for the ip entry.</p><pre><code class="yaml">ip: &quot;192.168.10.10&quot;</code></pre><p>Then for each site that will be hosted on the virtual machine add it's domain and ip to the /etc/hosts file.</p><pre><code class="shell">$ sudo nvim /etc/hosts</code></pre><pre><code class="shell">192.168.10.10 testsite.local</code></pre><h2>Configuring Homestead</h2><p>Homestead is configured by editing the Homestead.yaml file that was created with the init.sh command earlier.</p><pre><code class="shell">$ cd ~/.local/share/homestead
+$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/homestead/id_rsa</code></pre><h3>Hostname Resolution</h3><p>Since I am using one instance of Homestead for multiple sites I need to configure the host machine so that requests are directed to the correct site on the virtual machine. This is done by adding an entry into the /etc/hosts file for each site. </p><p>First I need to know the IP address of the virtual machine. This can be done by looking in the Homestead.yaml file for the ip entry.</p><pre><code class="yaml">ip: &quot;192.168.10.10&quot;</code></pre><p>Then for each site that will be hosted on the virtual machine add it's domain and ip to the /etc/hosts file. </p><pre><code class="shell">$ sudo nvim /etc/hosts</code></pre><pre><code class="shell">192.168.10.10 testsite.local</code></pre><h2>Configuring Homestead</h2><p>Homestead is configured by editing the Homestead.yaml file that was created with the init.sh command earlier.</p><pre><code class="shell">$ cd ~/.local/share/homestead
$ nvim Homestead.yaml</code></pre><p>First tell Vagrant that Virtualbox will be providing the virtual machine.</p><pre><code class="yaml">set provider: virtualbox</code></pre><p>Vagrant needs to setup the ssh keys between the host and the guest so that you can connect via ssh. Enter the path to the one created earlier.</p><pre><code class="yaml">authorize: ~/.ssh/homestead/id_rsa.pub
keys:
-- ~/.ssh/homestead/id_rsa</code></pre><p>Share the project folder with the virtual machine. This setting will make the directory /home/vagrant/projects/testsite available in the virtual machine. The contents of this directory will be shared with the host machine directory ~/projects/testsite.</p><pre><code class="yaml">folders:
-- map: ~/projects/testsite
-to: /home/vagrant/projects/testsite</code></pre><p>Setup Homestead so that it can serve the application through the 'domain' testsite.local. Note how this matches the name added to /etc/hosts earlier.</p><pre><code class="yaml">sites:
-- map: testsite.local
-to: /home/vagrant/projects/testsite/public</code></pre><p>Have Homestead create a database for our application.</p><pre><code class="yaml">databases:
-- testsite</code></pre><p>Since I'm using a database ensure that a database server is installed on the virtual machine.</p><pre><code class="yaml">features:
-- mariadb: true</code></pre><h2>Launching Homestead</h2><p>Homestead is started with the vagrant up command. It may take a while for Homestead to launch if this is the first time running this command as Vagrant has to first download the actual virtual machine file.</p><pre><code class="shell">$ cd ~/.local/share/homestead
+ - ~/.ssh/homestead/id_rsa</code></pre><p>Share the project folder with the virtual machine. This setting will make the directory /home/vagrant/projects/testsite available in the virtual machine. The contents of this directory will be shared with the host machine directory ~/projects/testsite.</p><pre><code class="yaml">folders:
+ - map: ~/projects/testsite
+ to: /home/vagrant/projects/testsite</code></pre><p>Setup Homestead so that it can serve the application through the 'domain' testsite.local. Note how this matches the name added to /etc/hosts earlier.</p><pre><code class="yaml">sites:
+ - map: testsite.local
+ to: /home/vagrant/projects/testsite/public</code></pre><p>Have Homestead create a database for our application.</p><pre><code class="yaml">databases:
+ - testsite</code></pre><p>Since I'm using a database ensure that a database server is installed on the virtual machine.</p><pre><code class="yaml">features:
+ - mariadb: true</code></pre><h2>Launching Homestead</h2><p>Homestead is started with the vagrant up command. It may take a while for Homestead to launch if this is the first time running this command as Vagrant has to first download the actual virtual machine file.</p><pre><code class="shell">$ cd ~/.local/share/homestead
$ vagrant up</code></pre><p>Once the machine is booted I can browse to http://testsite.local/ to see the simple site that is now served by Homestead.</p><h2>Installing a Laravel Site</h2><p>Now that Homestead is installed and serving a simple site its time to move onto installing the first Laravel application. Since Homestead provides all the tools required to do this the first thing to do is connect to the virtual machine.</p><pre><code class="shell">$ cd ~/.local/share/homestead
-$ vagrant ssh</code></pre><p>Once connected to the virtual machine navigate to the project folder of the site. Remember that this is the folder that is also been shared with the host machine.</p><pre><code class="shell">$ cd ~/projects/testsite</code></pre><p>Clear the contents of this folder otherwise composer will complain about a non-empty directory.</p><pre><code class="shell">$ rm -rf public</code></pre><p>Use composer to install a Laravel project.</p><pre><code class="shell">$ composer create-project laravel/laravel .</code></pre><h2>Setting Up The Application Database</h2><p>Once Larvel is installed a database needs to be created for the application. Connect to the database server with the mysql command.</p><pre><code class="shell">$ mysql -uhomestead -psecret</code></pre><p>Check that the application's database was created when the virtual machine was first booted.</p><pre><code class="mysql">SHOW DATABASES;
+$ vagrant ssh</code></pre><p>Once connected to the virtual machine navigate to the project folder of the site. Remember that this is the folder that is also been shared with the host machine.</p><pre><code class="shell">$ cd ~/projects/testsite</code></pre><p>Clear the contents of this folder otherwise composer will complain about a non-empty directory.</p><pre><code class="shell ">$ rm -rf public</code></pre><p>Use composer to install a Laravel project.</p><pre><code class="shell">$ composer create-project laravel/laravel .</code></pre><h2>Setting Up The Application Database</h2><p>Once Larvel is installed a database needs to be created for the application. Connect to the database server with the mysql command.</p><pre><code class="shell">$ mysql -uhomestead -psecret</code></pre><p>Check that the application's database was created when the virtual machine was first booted.</p><pre><code class="mysql">SHOW DATABASES;
+--------------------+
| Database |
@@ -63,8 +63,8 @@ DB_PORT=3306
DB_DATABASE=testsite
DB_USERNAME=testsite
DB_PASSWORD=testsite</pre><p>Now when you browse to http://testsite.local you will see the Laravel welcome page.</p><h2>Simplified SSH</h2><p>I prefer to just use the host system's ssh command to connect to Homestead as it cuts out having to navigate to the Homestead directory and running vagrant ssh.</p><p>To simplify ssh I first add a hostname for the virtual machine to the file /etc/hosts/</p><pre><code class="shell">192.168.10.10 homestead</code></pre><p>I then edit ~/.ssh/config and add the below configuration. This tells ssh to automatically use the keys and username specified when connecting to the virtual machine.</p><pre><code class="ssh">Host homestead
-IdentityFile ~/.ssh/homestead/id_rsa
-User vagrant</code></pre><p>From now on I can simply do ssh homestead from any directory to connect to the Homestead virtual machine.</p><h3>Links</h3><a href="https://laravel.com/docs/8.x/homestead/">Laravel Homestead</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
+ IdentityFile ~/.ssh/homestead/id_rsa
+ User vagrant</code></pre><p>From now on I can simply do ssh homestead from any directory to connect to the Homestead virtual machine.</p><h3>Links</h3><a href="https://laravel.com/docs/8.x/homestead/">Laravel Homestead</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
</entry><entry>
<title type="text">SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed</title>
<id>https://davidtsadler.com/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/index.html</id>
@@ -76,21 +76,21 @@ User vagrant</code></pre><p>From now on I can simply do ssh homestead from any d
Illuminate\Database\QueryException
-SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = testsite and table_name = migrations and table_type = 'BASE TABLE')
-
-at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
-674▕ // If an exception occurs when attempting to run a query, we'll format the error
-675▕ // message to include the bindings with SQL, which will make this exception a
-676▕ // lot more helpful to the developer instead of just the database's errors.
-677▕ catch (Exception $e) {
-678▕ throw new QueryException(
-679▕ $query, $this-&gt;prepareBindings($bindings), $e
-680▕ );
-681▕ }
-682▕
-
-+33 vendor frames
-34 artisan:37
-Illuminate\Foundation\Console\Kernel::handle()</code></pre><p>The cause of this issue is due to a change introduced to the .env.example file. This changed the environment variable DB_HOST from 127.0.0.1 to mysql. The reason for this change is to support [Laravel Sail](https://laravel.com/docs/8.x/sail) which is a Docker development environment for Laravel.</p><p>The change means your Laravel application will try and connect to a database server with the hostname of mysql. Unless this exists then the application can't connect.</p><p>To resolve the issue just change the value back to 127.0.0.1</p><pre><code class="shell">DB_HOST=127.0.0.1</code></pre><h3>Links</h3><a href="https://github.com/laravel/laravel/commit/a895748980b3e055ffcb68b6bc1c2e5fad6ecb08#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8cL11">Commit that changed .env.example.</a><a href="https://laravel.com/docs/8.x/sail/">Laravel Sail</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
+ SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = testsite and table_name = migrations and table_type = 'BASE TABLE')
+
+ at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
+ 674▕ // If an exception occurs when attempting to run a query, we'll format the error
+ 675▕ // message to include the bindings with SQL, which will make this exception a
+ 676▕ // lot more helpful to the developer instead of just the database's errors.
+ 677▕ catch (Exception $e) {
+ 678▕ throw new QueryException(
+ 679▕ $query, $this-&gt;prepareBindings($bindings), $e
+ 680▕ );
+ 681▕ }
+ 682▕
+
+ +33 vendor frames
+ 34 artisan:37
+ Illuminate\Foundation\Console\Kernel::handle()</code></pre><p>The cause of this issue is due to a change introduced to the .env.example file. This changed the environment variable DB_HOST from 127.0.0.1 to mysql. The reason for this change is to support [Laravel Sail](https://laravel.com/docs/8.x/sail) which is a Docker development environment for Laravel.</p><p>The change means your Laravel application will try and connect to a database server with the hostname of mysql. Unless this exists then the application can't connect.</p><p>To resolve the issue just change the value back to 127.0.0.1</p><pre><code class="shell">DB_HOST=127.0.0.1</code></pre><h3>Links</h3><a href="https://github.com/laravel/laravel/commit/a895748980b3e055ffcb68b6bc1c2e5fad6ecb08#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8cL11">Commit that changed .env.example.</a><a href="https://laravel.com/docs/8.x/sail/">Laravel Sail</a><a href="/posts/larvel/">Laravel - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
</entry>
</feed> \ No newline at end of file
diff --git a/www/posts/laravel/index.html b/www/posts/laravel/index.html
index a5295c4..d410bf2 100644
--- a/www/posts/laravel/index.html
+++ b/www/posts/laravel/index.html
@@ -5,6 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Home of David T. Sadler - All Posts About Laravel</title>
<link rel="shortcut icon" href="/images/favicon.png">
+ <link rel="stylesheet" href="/css/modern-normalize.min.css">
+ <link rel="stylesheet" href="/css/highlight.min.css">
+ <link rel="stylesheet" href="/css/railscasts.css">
<link rel="stylesheet" href="/css/site.css">
<link href="/posts/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts"/>
<link href="/posts/arch/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts About Arch"/>
@@ -18,6 +21,8 @@
<link href="/posts/php/atom.xml" type="application/atom+xml" rel="alternate" title="The Home of David T. Sadler - All Posts About PHP"/>
</head>
<body>
- <section><h1>The Home of David T. Sadler - All Posts About Laravel</h1><a href="/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/">2020-12-21 - Installing Laravel Homestead in Arch Linux</a><a href="/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/">2020-12-14 - SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ <section><h1>The Home of David T. Sadler - All Posts About Laravel</h1><a href="/posts/laravel/2020-12-21/installing-laravel-homestead-in-arch-linux/">2020-12-21 - Installing Laravel Homestead in Arch Linux</a><a href="/posts/laravel/2020-12-14/sqlstate-hy000-2002-php-network-getaddresses-getaddrinfo-failed/">2020-12-14 - SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a></section>
+ <script src="/js/highlight.min.js"></script>
+ <script src="/js/site.js"></script>
</body>
</html>