Skip to content

Commit 63898a7

Browse files
committed
Fix minor issues with systemd
1 parent f397a52 commit 63898a7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

cli/Valet/PhpFpm.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,21 @@ public function getVersion($real = false)
204204
*
205205
* @return string
206206
*/
207-
public function fpmServiceName()
207+
public function fpmServiceName($serviceName = null)
208208
{
209-
$service = 'php' . $this->version . '-fpm';
209+
if($serviceName === null){
210+
$service = "php{$this->version}-fpm";
211+
}else{
212+
$service = $serviceName;
213+
}
210214
$status = $this->sm->status($service);
211-
212215
if (strpos($status, 'not-found') || strpos($status, 'not be found')) {
213-
return new DomainException("Unable to determine PHP service name.");
216+
$secondTry = $this->fpmServiceName("php-fpm{$this->version}");
217+
if($secondTry instanceof DomainException){
218+
return new DomainException("Unable to determine PHP service name.");
219+
}
220+
221+
return $secondTry;
214222
}
215223

216224
return $service;
@@ -226,6 +234,7 @@ public function fpmConfigPath()
226234
return collect([
227235
'/etc/php/' . $this->version . '/fpm/pool.d', // Ubuntu
228236
'/etc/php' . $this->version . '/fpm/pool.d', // Ubuntu
237+
'/etc/php' . $this->version . '/php-fpm.d', // Manjaro
229238
'/etc/php-fpm.d', // Fedora
230239
'/etc/php/php-fpm.d', // Arch
231240
'/etc/php7/fpm/php-fpm.d', // openSUSE

cli/Valet/ServiceManagers/Systemd.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function getRealService($service)
218218
{
219219
return collect($service)->first(
220220
function ($service) {
221-
return strpos($this->cli->run("systemctl status {$service} | grep Loaded"), 'Loaded: loaded');
221+
return strpos($this->cli->run("systemctl status {$service} | grep Loaded"), 'Loaded: loaded') >= 0;
222222
},
223223
function () {
224224
throw new DomainException("Unable to determine service name.");

0 commit comments

Comments
 (0)