Laravel valet always asks password - php

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.

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 server not starting

I have a fresh installed laravel app and when i run php artisan serve it shows me the server information but when i go to that server it gives a cant be reach error. I am not running Vagrant just MAMP but it used to work before. I did tried to install Vagrant in the past and it didn't work that is why i came back to MAMP only. I read something about generating a key with php artisan key:generate which didn't work. Any help is appreciated.
This is the command I am using and the result
$ php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
try to uninstall the antivirus if you have one ,in my case i uninstall avast ,reboot OS and it works for me .

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

How to use Laravel Homestead for development

I know this might sound really silly, but I'm kinda stuck and need help. I'm trying to use Laravel 5.3 and use Homestead as my IDE. I have previously worked on PHP using NetBeans and XAMPP, but the installation has always been a pain. I have no formal training and have learnt and used basic PHP on my own for my webpages.
I'm running a Windows 8-32Bit OS & here's what I've done so far:
I have downloaded Laravel using Composer.
I have installed Virtual Box & Vagrant.
I have installed Git Bash and ran vagrant box add laravel/homestead (Homestead.yaml was not found in my Homestead folder after running bash init.sh command. I downloaded it from Github and added there).
Set SSH Key.
Ran vagrant up in Homestead folder (the installation was complete).
Issues:
If I just type http://localhost:8000 in my browser, nothing happens. I have to run php artisan serve in the command prompt inside laravel directory and keep the prompt window open for the default Laravel 5 page to open.
If I type http://127.0.0.1:8000 in my browser, nothing happens at all.
So how do I use Homestead then for my development everyday ?
you can try
localhost/project-name/public
if you dont want to run php artisan serve

Install XAMPP as non-admin

I need to install xampp as a normal user and run PHP server with a non-default port.
I have changed the 'Listen 80' in ~/lampp/etc/httpd.conf to another port.
But when i start it using ~/lampp/lampp start, it complains
You need to start XAMPP as root!
Is there any way to run this without root login ?
You need to install xampp as root, but you can run as normal user.
Here is the step by step guides for the same.
http://forums.bizhat.com/linux-freebsd-opensource/41058-how-install-xampp-ubuntu-linux-running-normal-user.html

Categories