Why isn't Laravel Valet working with homebrew on Catalina? - laravel-valet

On a new MacBook Pro (Catalina), I have done the following:
Install homebrew
brew install php
Install composer
composer require laravel/valet
valet install
valet tld localhost
When I ping foo.localhost, I get:
cannot resolve test.localhost: Unknown host
Also, if I try to view a site in the browser eg test.localhost (which has a very basic index.html), then I get a not found error.
I have read all the previous answers and deleting everything and reinstalling didn't work.
Has anyone else come across this/have a solution?

Related

How to fix HTTPD (Apache) Error 256 on OSX Monterey 12.5

I have a Apache2 installed with Homebrew on a Mac running OSX Monterey. I haven't done LAMP development for a while, so I'm not sure when the error started, but I've recently updated OSX to 12.5. When I returned to working on a LAMP project, my Apache installation stopped working. Running brew services produced the following output: Name Status User File httpd error 256 root ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist mysql started Nizz0k ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
Running the stop, start, and restart commands produces "success" output in the terminal, but Apache doesn't work. I can't navigate to my local vhosts, and of course, running brew services still shows an error.
In running apachectl -e error Apache complains about permissions to the error logs
I have tried:
uninstalling and reinstalling HTTPD
The apr-utilities fix.
confirming Mac installed Apache is stopped.
At this point, I think my problem is that there was conflicting information about how to run Apache on Homebrew. Earlier versions apparently required sudo, but running it this was now produces warnings like this:
Warning: Taking root:admin ownership of some httpd paths:
/usr/local/Cellar/httpd/2.4.54/bin
/usr/local/Cellar/httpd/2.4.54/bin/httpd
/usr/local/opt/httpd
/usr/local/opt/httpd/bin
/usr/local/var/homebrew/linked/httpd
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: httpd must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.httpd.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist` exited with 37.
The issue is even after removing the paths as suggested in the error, a reinstallation brings Root back as the owner.
I do have the same problem with nginx.
Manually unloaded it and then restarting it worked fine.
Try:
sudo launchctl bootout system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
sudo brew services start httpd

Homebrew PHP Install Breaks Apache 2.4

When I recently installed PHP56 via Homebrew, Apache would no longer start, with this error in the logs:
Cannot load /usr/local/opt/php56/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php56/libexec/apache2/libphp5.so, 10): image not found
Note: I'm running Apache 2.4 on Mac El-Capitan.
How can I resolve this error and get Apache running again?
I've seen this before. If you brew options php56, it says:
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system
you have to install php with the --with-apache option. See brew options php56 for more details.
Thus, try uninstalling (brew uninstall php56) then reinstalling php56 with the flag --with-apache for Apache v2.4.x (--with-apache22 for Apache 2.2). Generally, you can check your Apache version by typing in command line: httpd -v.
My version is 2.4.18, so I would brew install php56 --with-apache, which creates the proper file path /usr/local/opt/php56/libexec/apache2/libphp5.so.
Now, it is properly compiled with Apache Handler module.
IMPORTANT: installing php56 with this option appears to also install httpd24. From a brew program stance, this makes sense. However, this may break your server set up. If you don't want to use brew's Apache install, do a brew unlink httpd24 after this.
To see additional brew build options, try brew options php56.

mix local.hex fails from SSL after updating Erlang

I was prompted to update Erlang on my machine and I did. Then when I restarted my server I was prompted to update using mix local.hex.
When i did this it gave me the following error.
mix local.hex --force didn't work either.
I eventually found out that I installed erlang originally without brew originally which is where the prompt came from. After I updated it, it caused an issue with mix local.hex.
I manually removed the folder /usr/local/lib/erlang and all erlang on my machine. I installed erlang using 'brew install erlang' and then ran 'brew link erlang'
This originally didn't work because I didn't have permission but then I ran the following to get permission.
sudo chown -R $(whoami) /usr/local/lib
After that 'brew link erlang' worked and I was able to run 'mix local.hex' like normal.

Laravel valet linked php error

I got an error.
$ valet install
[DomainException]
Unable to determine linked PHP.
install
'which' command returns:
$ which php
/usr/local/Cellar/php70/7.0.6/bin/php
I used Homebrew to instal php7.1 , So I ran this command in terminal
ln -s /usr/local/opt/php71/bin/php /usr/local/bin/php
and everything is done.
if your PHP version 7.x and valet > 2.0.8 update valet
valet stop
valet uninstall
brew install php
composer global require laravel/valet
then valet install
Homebrew creates (or attempts to create) symlinks in /usr/local/bin.
Start by running the following to attempt to create a link.
brew link php70
It'll give you information as to whether or not it was successful. Occasionally permissions are problematic and you can resolve this with
sudo chown -R `whoami`:admin /usr/local/bin
Then try running the brew link command again.
Alternately brew link may give you instructions, or you can use brew doctor to get a report on any problems which exist with your Homebrew installation.
When it's set up properly after running ls -la /usr/local/bin | grep bin/php$ you should see something similar to
lrwxr-xr-x 1 YOURUSER admin 29 10 May 21:40 php -> /usr/local/Cellar/php70/7.0.6/bin/php
I was going to update Laravel Valet from version 1.* to 2 and ran same error like this
Unable to determine linked PHP
The solution was to run
composer global update
before I ran
valet install
This happens when your brew php gets Updated.
If you do brew install php this will work but will install php 7.2 by default.
If you want php#7.1 you have to do brew install php#7.1 this will install php7.1 and now when you restart valet valet restart you might get an error. Unable to determine linked PHP.
To make this work with php7.1 you have make brew link
brew link php71
you may have this error
Warning: php#7.1 is keg-only and must be linked with
to fix this
brew link --force php71
now valet should work on php7.1
I tried all of the suggestions here—and several from elsewhere—before I hit on the solution. This applies to PHP 7.2 (no guarantee for other versions). If you are using the original Larvel Valet, open the file:
~/.composer/vendor/laravel/valet/cli/Valet/Brew.php
...or, if you're using Valet+
~/.composer/vendor/weprovide/valet-plus/cli/Valet/Brew.php
Locate the supportedPhpVersions method. In some versions, it will return an array right in the method:
return ['php72', 'php71', 'php70', 'php56'];
Change this to:
return ['7.2', 'php72', 'php71', 'php70', 'php56'];
In other cases, it'll reference const SUPPORTED_PHP_VERSIONS, and the change will be similar.
Save the file, restart valet, and Bob's your uncle!

How to setup php-fpm on CentOS 7?

There are a lot of guides out there about setup php-fpm for Apache on CentOS 5x or 6x but none of them are working on Centos 7. I searched for days but can't find any solution.
yum install php-fpm
This command succesfully working.
But then i stuck with this line:
yum install mod_fastcgi
The error is "There is no package as mod_fastcgi"
Is there any mod_fastcgi module compatible with CentOS 7? If so, how can i complete php-fpm setup? Please guide me.
My server have some trouble about memory usage. So i have to optimize Apache. Here is my "top" result.
Deploy PHP with FastCGI
If you are using PHP code with your application, you will need to implement “PHP-FastCGI” in order to allow Nginx to properly handle and parse PHP code. You can install this via YUM from the EPEL repository that was previously installed:
yum install php-cli php spawn-fcgi