valet-linux
valet-linux copied to clipboard
Bug: Can't install on Arch Linux
Basic info
| Distro (Name and version) | PHP Version | Valet version |
|---|---|---|
| EndeavourOS_Artemis_nova_22_9 | 8.1.3 | 2.2.37 |
Unable to install. EndeavourOS is plain Arch Linux. Installer demands php8.1-fpm but Arch only has php-fpm. Install fails.
I have the same problem, has anyone been able to solve it?
OS: Arch Linux - 6.0.12-arch1-1 PHP: 8.1.13 Compooser: 2.4.4
If it helps anyone, i solved it using 81 instead of 8.1, like this:
valet use 81
It was not really resolved.

if you don't use multiple php version. you can just return your php version directly on getPhpVersion in ~/.config/composer/vendor/cpriego/valet-linux/cli/Valet/PhpFpm.php
it works for me. using endeavour os.
in my case adding code return 72; working fine.
On Arch Linux, you only have the packages php-fpm and php7-fpm. So assuming that php81-fpm exists or specifying any version with valet use will not work since you would have to pass an empty string to the use command in order to use php-fpm.
Could you test this PR? https://github.com/cpriego/valet-linux/pull/378
I am using Arch/Manjaro and have the same issue.
The PR above will also support AUR packages like php81 and php-fpm81
Faced same issue. I am using Manjaro.
$ valet install
Nginx was already enabled
Stopping nginx...
[php8.2-fpm] is not installed, installing it now via Pacman... 🍻
error: target not found: php8.2-fpm
I have installed php-fpm already.
$ php --version
PHP 8.2.2 (cli) (built: Feb 1 2023 08:33:04) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.2, Copyright (c) Zend Technologies
As a workaround, I've changed ~/.config/composer/vendor/cpriego/valet-linux/cli/Valet/PhpFpm.php at line 393:
return 'php-fpm'; // from return "php{$version}-fpm
also at line 48
if (!$this->pm->installed("php-fpm")) { // instead of installed("php{$this->getPhpVersion}-fpm")
$this->pm->ensureInstalled("php-fpm"); // instead of ensureInstalled("php{$this->getPhpVersion}-fpm")
$this->sm->enable($this->fpmServiceName());
}
For temporary fixing, what I did was Changing the install function of this file: cli/Valet/PhpFpm.php
To:
public function install()
{
if (!$this->pm->installed("php-fpm")) {
$this->pm->ensureInstalled("php-fpm");
$this->sm->enable($this->fpmServiceName());
}
output('<info>PHP Logs');
$this->files->ensureDirExists('/var/log', user());
output('<info>Installing php config');
$this->installConfiguration();
output('<info>Restarting php-fpm');
$this->restart();
$this->symlinkPrimaryValetSock();
}
i.e., I just removed {$this->getPhpVersion()} from that function that worked for me temporary.
Still waiting for permanent solution
@andrewbernard
I've managed to manually fix this whilst maintaining the php switching feature.
First I've added a new Arch AUR repository to provide php packages named with a similar scheme phpxx-fpm.
The only difference is the missing dot in the php version scheme. Plus it supports more php versions thant the default repo.
So I ended up changing the normalizePhpVersion() in ~/.config/composer/vendor/cpriego/valet-linux/cli/Valet/PhpFpm.php line 84 to return a php version without the dot like so :
public static function normalizePhpVersion($version)
{
return substr(preg_replace('/(?:php@?)?([0-9+])(?:.)?([0-9+])/i', '$1$2', (string)$version), 0, 2);
}
All in all it's a pretty minor change in the code base. Works fine for the time being. Will report back if I end up facing issues with it in the future, but for now I was able to successfully install Valet and ping a .test address