Skip to content

Instantly share code, notes, and snippets.

@nntoan
Created March 25, 2023 04:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nntoan/39fdf4d667b414f2011a851ea027a81a to your computer and use it in GitHub Desktop.
Save nntoan/39fdf4d667b414f2011a851ea027a81a to your computer and use it in GitHub Desktop.
VALET PROMAX V3 (2.4.0-beta5)
@package weprovide/valet-plus
@version >= 2.4.0-beta5
--- cli/Valet/PhpFpm.php
+++ cli/Valet/PhpFpm.php (date 1667469040112)
@@ -31,6 +31,7 @@
];
const LOCAL_PHP_FOLDER = '/etc/php/';
+ const HOMEBREW_OPT_FOLDER = '/opt/php@%s/';
protected $architecture;
protected $brew;
@@ -161,6 +162,19 @@
return $confLookup[$this->linkedPhp()];
}
+ /**
+ * Get the path to the included extension library for the current PHP version.
+ *
+ * @param string $version
+ * @return string
+ */
+ public function phpCoreExtPath($version): string
+ {
+ $brewPath = $this->architecture->getBrewPath();
+
+ return $brewPath . sprintf(self::HOMEBREW_OPT_FOLDER, $version) . '/include/php/ext';
+ }
+
/**
* Get the formula name for a PHP version.
*
@@ -212,11 +226,21 @@
return;
}
- // Relink libjpeg
- info('[libjpeg] Relinking');
- $this->cli->passthru(
- 'sudo ln -fs /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dylib'
- );
+ if ($this->architecture->isArm64() === false) {
+ // Relink libjpeg
+ info('[libjpeg] Relinking');
+ $this->cli->passthru(
+ 'sudo ln -fs /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dylib'
+ );
+ }
+
+ if ($this->architecture->isArm64() === true) {
+ // Relink pcre2
+ info('[pcre2] Relinking');
+ $this->cli->passthru(
+ sprintf('sudo ln -fs /opt/homebrew/include/pcre2.h %s/pcre/pcre2.h', $this->phpCoreExtPath($version))
+ );
+ }
if (!$this->linkPhp($version, $currentVersion)) {
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment