1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-08 01:10:08 +01:00

Point PHP-FPM error_log to user directory

Old: `/usr/local/var/log/php-fpm.log`
New: `~/.config/valet/Log/php-fpm.log`

(We already put `~/.config/valet/Log/nginx-error.log` there)

This avoids ARM Mac differences in directory paths.
This commit is contained in:
Chris Brown
2020-11-23 09:21:55 -05:00
parent 81dcdbb960
commit ce0999f8cd
3 changed files with 20 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ function install()
$this->brew->ensureInstalled('php', [], $this->taps); $this->brew->ensureInstalled('php', [], $this->taps);
} }
$this->files->ensureDirExists('/usr/local/var/log', user()); $this->files->ensureDirExists(VALET_HOME_PATH . '/Log', user());
$this->updateConfiguration(); $this->updateConfiguration();
@@ -77,7 +77,7 @@ function updateConfiguration()
} }
if (false === strpos($fpmConfigFile, '5.6')) { 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 = $this->files->get(__DIR__.'/../stubs/etc-phpfpm-valet.conf');
$contents = str_replace(['VALET_USER', 'VALET_HOME_PATH'], [user(), VALET_HOME_PATH], $contents); $contents = str_replace(['VALET_USER', 'VALET_HOME_PATH'], [user(), VALET_HOME_PATH], $contents);
} else { } else {
@@ -93,13 +93,21 @@ function updateConfiguration()
$this->files->put($fpmConfigFile, $contents); $this->files->put($fpmConfigFile, $contents);
$contents = $this->files->get(__DIR__.'/../stubs/php-memory-limits.ini'); $contents = $this->files->get(__DIR__.'/../stubs/php-memory-limits.ini');
$destFile = dirname($fpmConfigFile); $destFile = dirname($fpmConfigFile);
$destFile = str_replace('/php-fpm.d', '', $destFile); $destFile = str_replace('/php-fpm.d', '', $destFile);
$destFile .= '/conf.d/php-memory-limits.ini'; $destFile .= '/conf.d/php-memory-limits.ini';
$this->files->ensureDirExists(dirname($destFile), user()); $this->files->ensureDirExists(dirname($destFile), user());
$this->files->putAsUser($destFile, $contents); $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());
} }
/** /**

View File

@@ -0,0 +1,5 @@
# php-fpm error logging directives
error_log="VALET_HOME_PATH/Log/php-fpm.log"
log_errors=on
log_level=debug

View File

@@ -13,7 +13,7 @@ listen.mode = 0777
;php_admin_value[upload_max_filesize] = 128M ;php_admin_value[upload_max_filesize] = 128M
;php_admin_value[post_max_size] = 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 ;php_admin_flag[log_errors] = on