15-03-2019
This commit is contained in:
133
docs/macos/webserver/php73.md
Normal file
133
docs/macos/webserver/php73.md
Normal file
@@ -0,0 +1,133 @@
|
||||
# PHP 7.3
|
||||
|
||||
|
||||
|
||||
### Changer de version de PHP:
|
||||
|
||||
```bash
|
||||
$ brew unlink php@7.3 && brew link --force --overwrite php@5.6
|
||||
```
|
||||
|
||||
On installe un petit utilitaire [PHP Switcher Script](https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2)
|
||||
|
||||
```bash
|
||||
$ curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw > /usr/local/bin/sphp
|
||||
$ chmod +x /usr/local/bin/sphp
|
||||
|
||||
|
||||
```
|
||||
|
||||
Ensuite. pour changer de version:
|
||||
|
||||
```bash
|
||||
$ sphp 7.3
|
||||
```
|
||||
|
||||
Par exemple, pour passer de 7.2.13. à 7.3.0_1:
|
||||
|
||||
```bash
|
||||
$ sphp 7.3
|
||||
Switching to php@7.3
|
||||
Switching your shell
|
||||
Unlinking /usr/local/Cellar/php@7.2/7.2.13... 25 symlinks removed
|
||||
Unlinking /usr/local/Cellar/php/7.3.0_1... 0 symlinks removed
|
||||
Linking /usr/local/Cellar/php/7.3.0_1... 24 symlinks created
|
||||
You will need sudo power from now on
|
||||
Switching your apache conf
|
||||
Password:
|
||||
Restarting apache
|
||||
|
||||
PHP 7.3.0 (cli) (built: Jan 3 2019 10:08:00) ( NTS )
|
||||
Copyright (c) 1997-2018 The PHP Group
|
||||
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
|
||||
with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies
|
||||
|
||||
All done!
|
||||
```
|
||||
|
||||
Il y a un autre utilitaire (<u>brew-php-switcher</u>):
|
||||
|
||||
```bash
|
||||
$ brew info brew-php-switcher
|
||||
brew-php-switcher: stable 2.0, HEAD
|
||||
Switch Apache / Valet / CLI configs between PHP versions
|
||||
https://github.com/philcook/php-switcher
|
||||
Not installed
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Extensions:
|
||||
|
||||
#### Liste des extensions (Homebrew):
|
||||
|
||||
```bash
|
||||
$ brew search php73
|
||||
```
|
||||
|
||||
#### Installer des extensions:
|
||||
|
||||
Elles s'installent via [PECL](https://pecl.php.net) (requiert autoconf, `brew install autoconf`).
|
||||
|
||||
- ```bash
|
||||
$ pecl uninstall -r xdebug
|
||||
|
||||
$ pecl install xdebug
|
||||
$ pecl install yaml
|
||||
$ pecl install redis
|
||||
$ pecl install apcu
|
||||
$ pecl install memcached
|
||||
$ pecl install imagick
|
||||
|
||||
# Pour une version spécifique:
|
||||
$ pecl install xdebug-2.7.0beta1
|
||||
```
|
||||
|
||||
Pour les activer, créez un fichier de configuration dans `/usr/local/etc/php/7.3/conf.d/`
|
||||
|
||||
```bash
|
||||
bruno@silverbook:/usr/local/etc/php/7.3/conf.d$ l
|
||||
total 32
|
||||
drwxr-xr-x 6 bruno admin 192 4 jan 19:32 .
|
||||
drwxr-xr-x 9 bruno admin 288 3 jan 19:34 ..
|
||||
-rw-r--r-- 1 bruno admin 72 4 jan 16:09 ext-opcache.ini
|
||||
-rw-r--r-- 1 bruno admin 172 4 jan 18:58 ext-xdebug.ini
|
||||
-rw-r--r-- 1 bruno admin 81 4 jan 18:43 ext-yaml.ini
|
||||
-rw-r--r-- 1 bruno admin 87 13 déc 07:12 fix-jit.ini
|
||||
|
||||
bruno@silverbook:/usr/local/etc/php/7.3/conf.d$ nano ext-xdebug.ini
|
||||
|
||||
[xdebug]
|
||||
zend_extension="/usr/local/lib/php/pecl/20180731/xdebug.so"
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_host=localhost
|
||||
xdebug.remote_handler=dbgp
|
||||
xdebug.remote_port=9000
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Erreurs:
|
||||
|
||||
#### Warning: preg_replace(): JIT compilation failed: no more memory in
|
||||
|
||||
Il s'agit d'un [bug](https://bugs.php.net/bug.php?id=77260) connu de PHP 7.3.
|
||||
|
||||
2 solutions:
|
||||
|
||||
- désinstaller php 7.3
|
||||
`$ brew uninstall php@7.3`
|
||||
- désactiver la compilation PCRE JIT dans le php.ini
|
||||
`pcre.jit=0`
|
||||
|
||||
|
||||
|
||||
Pour désactiver la compilation PCRE JIT, on peut aussi créer un fichier `fix-jit.ini` dans `/usr/local/etc/php/7.3/conf.d`et y ajouter:
|
||||
|
||||
```php
|
||||
; My php.ini settings
|
||||
; Fix for PCRE "JIT compilation failed" error
|
||||
[Pcre]
|
||||
pcre.jit=0
|
||||
```
|
||||
Reference in New Issue
Block a user