'vagrant up' not working while installing homestead on ubuntu 14.04 - php

I run ubuntu 14.04 trusty. I installed virtual box and vagrant in order to be able to use laravel. I installed laravel homestead via git and I am trying to run the command 'vagrant up' but I get an error. Please what am I doing wrong?
I tried to add vagrant box with this command 'vagrant box add laravel/homestead' but I got the error below:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

Can you run vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead --insecure
Using the --insecure flag it does not validate SSL certificates so you should not have the SSL error
You may need to clean ~/.vagrant.d/tmp/ folder if you have some uncompleted transfer
You can also download the ssl certificate and directly use it to bypass the error
$ vagrant box add --cacert <certificate> box_name

I had the same error yesterday twice. I just removed the tmp folder in ~/.vagrant.d and ran again 'vagrant box add laravel/homestead'. I realized that when my laptop suspends due to non-activity, the command just fails, so what I did is disable the suspend after 30 min and activate 'Never Suspend' (that option depends obviously on your environment)
On Ubuntu 14 just right click the battery icon and choose Energy Options.

Related

Curl error thrown for http POST to /session

I installed Laravel Dusk for website testing. I tried every solution on Stackoverflow regarding this problem but nothing worked.
I need to run browser headless because I'm running tests on my Linux server.
Current version of chromedriver-linux is:
./vendor/laravel/dusk/bin/chromedriver-linux --v
ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430#{#429})
Current version of Chromium is:
chromium-browser --version --no-sandbox
Chromium 90.0.4430.93 snap
When I run Dusk I get error:
Operation timed out after 30001 milliseconds with 0 bytes received
Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","platformName":"linux","goog:chromeOptions":{"args":["--headless","--disable-gpu","--no-sandbox"]}}]},"desiredCapabilities":{"browserName":"chrome","platform":"linux","chromeOptions":{"args":["--headless","--disable-gpu","--no-sandbox"]}}}
Is there any way to resolve this? I tried by adding arguments "--headless","--disable-gpu","--no-sandbox" but unfortunately it is not working.
friend!
I assume you are on Windows host with Homestead (Windows 10, Homestead 10 and Laravel 8). If not, I am not sure this answer will help. But this just helped me, literally, a few minutes ago, so I feel obliged.
Dusk appears not like Chromium and desires a full Chrome. So lets install it:
cd ~
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
This will download the latest stable google chrome and install it.
Do make sure that you got your project's vendor/laravel/dusk/bin/ folder is executable, as the docs suggest. So, in the root of your project:
chmod -R 0755 vendor/laravel/dusk/bin/
Make sure you got the latest chromium-driver installed:
php artisan dusk:chrome-driver --detect
3.1. If it will give you hard time (cannot rename, cannot move files, yada-yada) - it is probably because you have the driver already running, so exit Homestead and just
vagrant reload
return back to homestead and repeat 3 above.
Make sure you are able to curl your APP_URL. Let's say it is laravel.app:
curl http://laravel.app
If not, check /etc/hosts, you expect to see something like 127.0.0.1 laravel.app - following our assumption about the URL. This is normally set by Homestead itself, when you provision a new site.
Voila.
php artisan dusk
was successful.
That fixed it for me.
I have spent exorbitant amount of time which could have been saved by a single line in docs "If you are running Homestead on Windows, make sure to install Google Chrome"
Happy coding!

Laravel valet park shows XAMPP main page

I am currently learning PHP Laravel. I am in the process of setting up valet. However, I encountered a problem. Whenever I type (filename).dev, it shows the XAMPP main page instead of the Laravel initial project page. Can someone explain why this is happening?
The original answer can be found here.
Remove valet completely (some reason valet uninstall does nothing) so to get the latest version (v1.1.3 at the time)
Stop Apache: apachectl stop
Update Valet: composer global require laravel/valet
Install Valet: valet install
Restart Valet: valet restart
With some others, it might be a good option to try and simply turn-off/stop your locally running Apache, as this as others might find is only the issue that fixes it.
I faced the same issue as I was running Xampp and Valet at the same time on my Windows Machine, try turning off the xampp/apache and run the page again.
Steps to install Valet on Windows..
Install composer from https://getcomposer.org/download/
Then run composer global require cretueusebiu/valet-windows
Then run: "valet install"
Open your Laravel project directory in cmd (administrator mode)
Then run: "valet park"
Then run: "valet link"
Then run: "valet secure" (if you want your website to be secured by TLS)
In the control panel/network and sharing center choose the active connection and in its properties enter 127.0.0.1 in TCP/IPv4 IPv4 settings
In the control panel/network and sharing center choose the active connection and in its properties enter ::1 in TCP/IPv6 IPv6 settings
Then run: "valet start"
Enter the "projectname" followed by ".test" in the browser.
For example: if your project name is demolaravel, then run demolaravel.test in the browser

Laravel valet always asks password

After reinstalling macOS, I started setup my dev environment based on Laracasts "Setup a mac dev machine from scratch". At the previous time when I installed php/valet/composer etc, everything was fine, but now the terminal (in every new session) always asks password when I type valet.
I added the composer path to .zshrc
export PATH=$HOME/bin:/usr/local/bin:$HOME/.composer/vendor/bin:$PATH
In order to get this going you can run the following command:
$ valet trust
This will let you enter the password once, and remember it.
Using the trust command, you indicate that the current machine can be trusted for development, and Valet will stop asking for the password.
Your macOS native apache might be running, try stopping it
sudo apachectl stop
running sudo valet start fixed it for me.

Error when run "composer update". Windows / Vagrant / Laravel Homestead

Installed stack: Windows 7 64x / Vagrant / Oracle VM Box / Laravel Homestead.
Mapping works, laravel's site's works. But when I run command: "composer update" - I get error message:
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
P.S. I have done:
Disable windows defender
Turn off firewall
Run composer clear cache
Run composer diagnose - everything is ok
php.ini - zlib is turned on
there are no antivirus soft on my system
I've been having the same issue! What works for me so far is disabling XDebug on the CLI, which at least allows degraded mode to work.
To make it work, run this command when SSH'd into your Homestead box:
$ sudo phpdismod -s cli xdebug
Hope it helps!

vagrant lamp box authentication failure when "booting up"

I'm new to vagrant and followed along with the getting started tutorial and was able to initialize and run the precise32 box and serve a "hello world" index.html file from http://127.0.0.1:8080.
However, I want to run a PHP box so I grabbed the most popular LAMP box (scotch/box) off the vagrant cloud.
My problem is that when I run the setup command for the LAMP box:
vagrant init scotch/box; vagrant up --provider virtualbox
The box does not appear to boot up and instead I receive the following message:
Authentication failure. Retrying...
I have a brand new Virtual Box install (5.0.6) am on OSX (Yosemite) and I'm not trying to do anything out of the ordinary, just run a PHP machine. Any ideas where I'm going wrong?
I have no idea why several of the most popular boxes would not work for me... but for anyone else who comes across this, I just tried several boxes until I found one that actually worked as advertised (at least with my configuration). The box that worked for me was: smallhadroncollider/centos-6.5-lamp
Here are the full steps I took to create a working PHP environment using vagrant:
Install VirtualBox
Install Vagrant
Add a new vagrant box: vagrant box add smallhadroncollider/centos-6.5-lamp
Create new empty directory and navigate to it within terminal... once there, initialize your new vagrant box: vagrant init smallhadroncollider/centos-6.5-lamp
Edit the auto-generated vagrant file which was created in the directory where you just ran the vagrant init command and comment-in the "forwarded_port" setting to allow host machine port 8080 (or whatever port you choose) to route to virtual server port 80.
Start-up your new vagrant box: vagrant up --provider virtualbox
Create index.php file in the same directory as your vagrant file. Run it from http://127.0.0.1:8080 and it should process your PHP code
Now, enable debugging messages by SSHing into your new vagrant box with vagrant ssh
Enable debug output by editing php.ini on your vagrant machine (/etc/php5/apache2/php.ini) - if necessary, find where php.ini is stored using the phpinfo() function in your index.php file
While still on vagrant machine, restart Apache sudo /etc/init.d/apache2 restart. Ignore the "could not reliably determine... warning message."
exit vagrant box to return to your local machine. You're done and your PHP code should now be running with debug messages.

Categories