You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 999492b
Browse filesBrowse the repository at this point in the historyBrowse files
Keep libgit2 loaded with php-fpm through LibGit2DriverFactory::preload()
PHP unloads a library at the end of every request, so each php-fpm
request loaded and initialized libgit2 again: about 10 ms, mostly OpenSSL
reading the CA certificates. Called from opcache.preload, preload()
loads libgit2 into an FFI scope that lives as long as the process, with a
header generated for the library path (FFI::load() reads it from the
header), and initializes it before php-fpm forks its workers: a request
then gets it in 0.1 ms. It also declares the classes of the driver while
preloading, which may then call FFI with the default ffi.enable=preload.
Checked with forked workers of the built-in server: TLS (an HTTPS remote)
works after the fork.
thrownewUnsupportedOperationException('The "ffi" driver requires the FFI extension; use the "cli" driver.');
@@ -96,36 +169,32 @@ private static function doLoad(?string $libraryPath): \FFI
96
169
\FFI::cdef();
97
170
} catch (\FFI\Exception$e) {
98
171
// ffi.enable defaults to "preload": outside the CLI, only preloaded code can use FFI.
99
-
thrownewUnsupportedOperationException('The "ffi.enable" setting restricts the FFI API: set it to "true", preload gitlib, or use the "cli" driver.', 0, $e);
172
+
thrownewUnsupportedOperationException('The "ffi.enable" setting restricts the FFI API: call LibGit2DriverFactory::preload() from the opcache.preload script, set "ffi.enable" to "true", or use the "cli" driver.', 0, $e);
$this->assertSame('The "ffi.enable" setting restricts the FFI API: call LibGit2DriverFactory::preload() from the opcache.preload script, set "ffi.enable" to "true", or use the "cli" driver.', $process->getOutput());
$this->assertSame('The "ffi.enable" setting restricts the FFI API: set it to "true", preload gitlib, or use the "cli" driver.', $process->getOutput());
0 commit comments