Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cli/Valet/PhpFpm.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function install()
$this->brew->ensureInstalled('php', [], $this->taps);
}

$this->files->ensureDirExists('/usr/local/var/log', user());
$this->files->ensureDirExists(VALET_HOME_PATH . '/Log', user());

$this->updateConfiguration();

Expand All @@ -47,7 +47,7 @@ function install()

/**
* Forcefully uninstall all of Valet's supported PHP versions and configurations
*
*
* @return void
*/
function uninstall()
Expand Down Expand Up @@ -77,7 +77,7 @@ function updateConfiguration()
}

if (false === strpos($fpmConfigFile, '5.6')) {
// for PHP 7 we can simply drop in a valet-specific fpm pool config, and not touch the default config
// since PHP 7 we can simply drop in a valet-specific fpm pool config, and not touch the default config
$contents = $this->files->get(__DIR__.'/../stubs/etc-phpfpm-valet.conf');
$contents = str_replace(['VALET_USER', 'VALET_HOME_PATH'], [user(), VALET_HOME_PATH], $contents);
} else {
Expand All @@ -93,13 +93,21 @@ function updateConfiguration()
$this->files->put($fpmConfigFile, $contents);

$contents = $this->files->get(__DIR__.'/../stubs/php-memory-limits.ini');

$destFile = dirname($fpmConfigFile);
$destFile = str_replace('/php-fpm.d', '', $destFile);
$destFile .= '/conf.d/php-memory-limits.ini';
$this->files->ensureDirExists(dirname($destFile), user());
$this->files->putAsUser($destFile, $contents);

$contents = $this->files->get(__DIR__.'/../stubs/etc-phpfpm-error_log.ini');
$contents = str_replace(['VALET_USER', 'VALET_HOME_PATH'], [user(), VALET_HOME_PATH], $contents);
$destFile = dirname($fpmConfigFile);
$destFile = str_replace('/php-fpm.d', '', $destFile);
$destFile .= '/conf.d/error_log.ini';
$this->files->ensureDirExists(dirname($destFile), user());
$this->files->putAsUser($destFile, $contents);
$this->files->ensureDirExists(VALET_HOME_PATH . '/Log', user());
$this->files->touch(VALET_HOME_PATH . '/Log/php-fpm.log', user());
}

/**
Expand Down Expand Up @@ -202,7 +210,7 @@ function validateRequestedVersion($version)
if (strpos($this->brew->determineAliasedVersion($version), '@')) {
return $version;
}

if ($this->brew->hasInstalledPhp()) {
throw new DomainException('Brew is already using PHP '.PHP_VERSION.' as \'php\' in Homebrew. To use another version, please specify. eg: php@7.3');
}
Expand Down
5 changes: 5 additions & 0 deletions cli/stubs/etc-phpfpm-error_log.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# php-fpm error logging directives

error_log="VALET_HOME_PATH/Log/php-fpm.log"
log_errors=on
log_level=debug
2 changes: 1 addition & 1 deletion cli/stubs/etc-phpfpm-valet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ listen.mode = 0777
;php_admin_value[upload_max_filesize] = 128M
;php_admin_value[post_max_size] = 128M

;php_admin_value[error_log] = VALET_HOME_PATH/Log/fpm-php.www.log
;php_admin_value[error_log] = VALET_HOME_PATH/Log/php-fpm.log
;php_admin_flag[log_errors] = on


Expand Down