133 lines
2.0 KiB
Markdown
133 lines
2.0 KiB
Markdown
# Configurer PHP (mod-php)(Apache 2.2-)
|
|
|
|
#### php.ini
|
|
|
|
Mac intel:
|
|
|
|
```bash
|
|
$ nano /usr/local/etc/php/7.4/php.ini
|
|
$ nano /usr/local/etc/php/8.0/php.ini
|
|
```
|
|
|
|
Mac M1:
|
|
|
|
```bash
|
|
$ nano /opt/homebrew/etc/php/7.4/php.ini
|
|
$ nano /opt/homebrew/etc/php/8.0/php.ini
|
|
```
|
|
|
|
|
|
|
|
```ini
|
|
[Date]
|
|
; Defines the default timezone used by the date functions
|
|
; http://php.net/date.timezone
|
|
date.timezone = Europe/Paris
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
; Error handling and logging ;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
error_log = php_errors.log
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;
|
|
; Resource Limits ;
|
|
;;;;;;;;;;;;;;;;;;;
|
|
|
|
memory_limit = 512M
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Modifier le httpd.conf:
|
|
|
|
Mac intel:
|
|
|
|
```bash
|
|
$ nano /usr/local/etc/httpd/httpd.conf
|
|
```
|
|
|
|
Mac M1:
|
|
|
|
```bash
|
|
$ nano /opt/homebrew/etc/httpd/httpd.conf
|
|
```
|
|
|
|
Dans *httpd.conf*, ajouter les lignes:
|
|
|
|
Mac intel:
|
|
|
|
```http
|
|
LoadModule php7_module /usr/localopt/php@7.4/lib/httpd/modules/libphp7.so
|
|
#LoadModule php_module /usr/local/opt/php@8.0/lib/httpd/modules/libphp.so
|
|
```
|
|
|
|
Mac M1:
|
|
|
|
```http
|
|
LoadModule php7_module /opt/homebrew/opt/php@7.4/lib/httpd/modules/libphp7.so
|
|
#LoadModule php_module /opt/homebrew/opt/php@8.0/lib/httpd/modules/libphp.so
|
|
```
|
|
|
|
intel / M1:
|
|
|
|
Remplacer:
|
|
|
|
```http
|
|
<IfModule dir_module>
|
|
DirectoryIndex index.html
|
|
</IfModule>
|
|
```
|
|
|
|
par
|
|
|
|
```http
|
|
<IfModule dir_module>
|
|
DirectoryIndex index.php index.html
|
|
</IfModule>
|
|
|
|
<FilesMatch \.php$>
|
|
SetHandler application/x-httpd-php
|
|
</FilesMatch>
|
|
```
|
|
|
|
|
|
|
|
### Changer de version:
|
|
|
|
#### Méthode 1:
|
|
|
|
```bash
|
|
$ brew unlink php && brew link --overwrite --force php@7.4
|
|
```
|
|
|
|
#### Méthode 2:
|
|
|
|
*PHP switcher script*
|
|
|
|
Installation Mac intel:
|
|
|
|
```bash
|
|
$ curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw/0c36a5067fbd63e6a36700a6aaa119df0836bdfc/sphp.sh > /usr/local/bin/sphp
|
|
$ chmod +x /usr/local/bin/sphp
|
|
```
|
|
|
|
Installation Mac M1:
|
|
|
|
```bash
|
|
$ curl -L https://raw.githubusercontent.com/vadimbk/sphp/main/sphp > /opt/homebrew/bin/sphp
|
|
$ chmod +x /opt/homebrew/bin/sphp
|
|
```
|
|
|
|
Utilisation:
|
|
|
|
```bash
|
|
$ sphp 7.4
|
|
```
|
|
|
|
|
|
|