Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Can't install on Arch Linux #402

Open
andrewbernard opened this issue Dec 9, 2022 · 10 comments
Open

Bug: Can't install on Arch Linux #402

andrewbernard opened this issue Dec 9, 2022 · 10 comments

Comments

@andrewbernard
Copy link

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.

@josefo727
Copy link

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

@josefo727
Copy link

If it helps anyone, i solved it using 81 instead of 8.1, like this:

valet use 81

@josefo727
Copy link

It was not really resolved.

2022-12-14_10-01

@nhawa
Copy link

nhawa commented Jan 6, 2023

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.

@plorenz-etes
Copy link

plorenz-etes commented Jan 19, 2023

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.

@codepuncher
Copy link

Could you test this PR? #378

I am using Arch/Manjaro and have the same issue.
The PR above will also support AUR packages like php81 and php-fpm81

@axel-verse
Copy link

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

@axel-verse
Copy link

axel-verse commented Feb 12, 2023

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());
        }

@abbasmashaddy72
Copy link

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

@JoelAlphonso
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants