From 3facbef790133c81d38b1a6b0c188c4799d9d79b Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Sat, 24 Sep 2016 16:29:44 -0400 Subject: [PATCH] Disable default_mimetype with ini_set instead of via config file --- cli/Valet/PhpFpm.php | 11 ----------- cli/drivers/ValetDriver.php | 1 + tests/PhpFpmTest.php | 8 -------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/cli/Valet/PhpFpm.php b/cli/Valet/PhpFpm.php index 9fd3c3d..06392e4 100644 --- a/cli/Valet/PhpFpm.php +++ b/cli/Valet/PhpFpm.php @@ -46,7 +46,6 @@ function install() $this->files->ensureDirExists('/usr/local/var/log', user()); $this->updateConfiguration(); - $this->updateIni(); $this->restart(); } @@ -67,16 +66,6 @@ function updateConfiguration() $this->files->put($this->fpmConfigPath(), $contents); } - /** - * Update the PHP FPM ini. - * - * @return void - */ - function updateIni() - { - $this->files->copyAsUser(__DIR__.'/../stubs/valet.ini', $this->fpmIniPath()); - } - /** * Restart the PHP FPM process. * diff --git a/cli/drivers/ValetDriver.php b/cli/drivers/ValetDriver.php index b8ffa59..99b9b05 100644 --- a/cli/drivers/ValetDriver.php +++ b/cli/drivers/ValetDriver.php @@ -119,6 +119,7 @@ public function mutateUri($uri) */ public function serveStaticFile($staticFilePath, $sitePath, $siteName, $uri) { + ini_set('default_mimetype', ''); header('X-Accel-Redirect: ' . $staticFilePath); } diff --git a/tests/PhpFpmTest.php b/tests/PhpFpmTest.php index a518dbf..206b73c 100644 --- a/tests/PhpFpmTest.php +++ b/tests/PhpFpmTest.php @@ -31,14 +31,6 @@ public function test_fpm_is_configured_with_the_correct_user_group_and_socket() $this->assertTrue(strpos($contents, "\ngroup = staff") !== false); $this->assertTrue(strpos($contents, "\nlisten = /var/run/fpm-valet.socket") !== false); } - - public function test_default_mimetype_is_disabled_in_php_ini() - { - copy(__DIR__.'/files/ini.conf', __DIR__.'/output/ini.conf'); - resolve(StubForUpdatingFpmConfigFiles::class)->updateIni(); - $contents = file_get_contents(__DIR__.'/output/ini.conf'); - $this->assertTrue(strpos($contents, 'default_mimetype = ""') !== false); - } }