15-09-2021
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Homebrew-Cask
|
||||
# Homebrew-Cask
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -887,7 +887,7 @@ Ajouter `PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"` et `PATH="/usr/lo
|
||||
|
||||
### Erreurs:
|
||||
|
||||
**`require': cannot load such file -- active_support/core_ext/object/blank (LoadError)**
|
||||
#### 1. `require': cannot load such file -- active_support/core_ext/object/blank (LoadError)
|
||||
|
||||
```bash
|
||||
# Erreur sur chaque commande brew...
|
||||
@@ -903,7 +903,7 @@ Traceback (most recent call last):
|
||||
|
||||
```
|
||||
|
||||
Lancer **brew update-reset** pour réparer:
|
||||
<u>Solution:</u> Lancer **brew update-reset** pour réparer:
|
||||
|
||||
```bash
|
||||
% brew update-reset
|
||||
@@ -932,6 +932,105 @@ Your branch is up to date with 'origin/master'.
|
||||
|
||||
|
||||
|
||||
#### 2. Some taps are not on the default git origin branch
|
||||
|
||||
`brew doctor` dit:
|
||||
|
||||
```bash
|
||||
Warning: Some taps are not on the default git origin branch and may not receive
|
||||
updates. If this is a surprise to you, check out the default branch with:
|
||||
git -C $(brew --repo shivammathur/extensions) checkout master
|
||||
```
|
||||
|
||||
Lancer `git -C $(brew --repo shivammathur/extensions) checkout master`:
|
||||
|
||||
```bash
|
||||
git -C $(brew --repo shivammathur/extensions) checkout master
|
||||
.github/scripts/edit.sh: needs merge
|
||||
.github/workflows/tests-all.yml: needs merge
|
||||
Formula/vips@7.0.rb: needs merge
|
||||
Formula/vips@7.1.rb: needs merge
|
||||
Formula/vips@7.2.rb: needs merge
|
||||
Formula/vips@7.3.rb: needs merge
|
||||
Formula/vips@7.4.rb: needs merge
|
||||
Formula/vips@8.0.rb: needs merge
|
||||
Formula/vips@8.1.rb: needs merge
|
||||
error: vous devez d'abord résoudre votre index courant
|
||||
```
|
||||
|
||||
<u>Solution:</u>
|
||||
|
||||
If you want to keep the changes you made to those formula there is nothing you need to do. `brew doctor` only provides information and if you don't have problems you don't need to change anything.
|
||||
|
||||
If you want to discard the changes, the easiest way would be:
|
||||
|
||||
```bash
|
||||
git -C $(brew --repo shivammathur/extensions) add .
|
||||
git -C $(brew --repo shivammathur/extensions) reset --hard origin/master
|
||||
git -C $(brew --repo shivammathur/extensions) checkout master
|
||||
```
|
||||
|
||||
La dernière commande dit:
|
||||
|
||||
```bash
|
||||
HEAD's previous position was on 13d8b20 imap@8.1: update 8.1.0 bottle.
|
||||
Switching to the 'master' branch
|
||||
Your branch and 'origin / master' have diverged,
|
||||
and have 1 and 54 different commits each respectively.
|
||||
(use "git pull" to merge the remote branch into yours)
|
||||
```
|
||||
|
||||
Pour corriger, lancer:
|
||||
|
||||
```bash
|
||||
git -C $(brew --repo shivammathur/extensions) reset --hard origin/master
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 3. fatal: It seems that there is already a rebase-merge directory
|
||||
|
||||
```bash
|
||||
fatal: It seems that there is already a rebase-merge directory, and
|
||||
I wonder if you are in the middle of another rebase. If that is the case, please try
|
||||
git rebase (--continue | --abort | --skip)
|
||||
If that is not the case, please
|
||||
rm -fr ".git/rebase-merge"
|
||||
and run me again. I am stopping in case you still have something valuable there.
|
||||
```
|
||||
|
||||
Pour corriger, lancer:
|
||||
|
||||
```bash
|
||||
brew update-reset
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Réinstaller Homebrew
|
||||
|
||||
```bash
|
||||
cd $HOME
|
||||
|
||||
brew bundle dump
|
||||
brew bundle cleanup
|
||||
|
||||
# Désinstaller Homebrew
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
|
||||
|
||||
cd $(brew --prefix)
|
||||
# Supprimer manuellement les restes
|
||||
|
||||
cd $HOME
|
||||
|
||||
# Réinstaller Homebrew
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
|
||||
brew bundle install
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Cask:
|
||||
|
||||
### [:fa-link: Homebrew-Cask](brew-cask.md)
|
||||
@@ -162,6 +162,8 @@ $ up_venv mkdocs_env
|
||||
|
||||
```bash
|
||||
$ pip3 install django
|
||||
|
||||
$ python3 -m pip install dango
|
||||
```
|
||||
|
||||
Les modules sont ici:
|
||||
|
||||
@@ -170,7 +170,7 @@ alias bra='brew services restart httpd'
|
||||
|
||||
|
||||
|
||||
### [=> Installer PHP](php_M1.md)
|
||||
### [=> Installer PHP](php.md)
|
||||
|
||||
|
||||
|
||||
|
||||
132
docs/macos/webserver/mod-php.md
Normal file
132
docs/macos/webserver/mod-php.md
Normal file
@@ -0,0 +1,132 @@
|
||||
# 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
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -2,24 +2,6 @@
|
||||
|
||||
|
||||
|
||||
### Connexion à la base:
|
||||
|
||||
#### Se connecter à MySQL:
|
||||
|
||||
```bash
|
||||
$ mysql -u root -p
|
||||
Enter password:
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is 18
|
||||
Server version: 10.3.11-MariaDB Homebrew
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [(none)]>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Connexion à la base wordpress4 par l’utilisateur root:
|
||||
@@ -43,513 +25,11 @@ MariaDB [wordpress4]>
|
||||
|
||||
|
||||
|
||||
#### Quitter MySQL:
|
||||
|
||||
```bash
|
||||
MariaDB [wordpress4]> exit
|
||||
Bye
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Types de bases (moteur de stockage):
|
||||
|
||||
[InnoDB](https://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html)
|
||||
|
||||
Conseil: enable innodb_file_per_table = 1 option to put indexes and data for individual tables into distinct files.
|
||||
|
||||
Requête pour trouver les tables InnoDB parmi toutes les bases:
|
||||
|
||||
```mysql
|
||||
mysql> SELECT table_schema, table_name FROM INFORMATION_SCHEMA.TABLES WHERE engine = 'innodb';
|
||||
```
|
||||
|
||||
Constitution de Mysql (par défaut):
|
||||
|
||||
```bash
|
||||
bruno@silverbook:/usr/local/var/mysql$
|
||||
-rw-r----- 1 bruno admin 15114 28 nov 08:08 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 50331648 3 déc 10:35 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 50331648 24 oct 12:51 ib_logfile1
|
||||
-rw-rw---- 1 bruno admin 79691776 3 déc 10:35 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 28 nov 16:53 ibtmp1
|
||||
-rw-rw---- 1 bruno admin 1272770 3 déc 10:35 silverbook.home.err
|
||||
-rw-rw---- 1 bruno admin 5 28 nov 16:53 silverbook.home.pid
|
||||
```
|
||||
|
||||
- ibdata1: fichier de 10Mo extensible. InnoDB y stocke tout (bases,tables, index...) pour éviter la fragmentation.
|
||||
- ib_logfile0, ib_logfile1: 2 fichiers log de 5Mo.
|
||||
- ibtmp1
|
||||
- ib_buffer_pool:
|
||||
- silverbook.home.err: fichier log des erreurs
|
||||
|
||||
http://forum.wgpower.net/technique/innodb-fichier-ibdata1-trop-37009_1.html
|
||||
|
||||
https://vdachev.net/2007/02/22/mysql-reducing-ibdata1/
|
||||
|
||||
https://stackoverflow.com/questions/3456159/how-to-shrink-purge-ibdata1-file-in-mysql
|
||||
|
||||
|
||||
|
||||
[MyISAM](https://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html)
|
||||
|
||||
|
||||
|
||||
#### Connaitre le type de bases par défaut:
|
||||
|
||||
<u>mysql> show engine;</u>
|
||||
|
||||
```bash
|
||||
MariaDB [(none)]> show engines;
|
||||
|
||||
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
|
||||
|
||||
| Engine | Support | Comment | Transactions | XA | Savepoints |
|
||||
|
||||
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
|
||||
|
||||
| MRG_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
|
||||
|
||||
| CSV | YES | Stores tables as CSV files | NO | NO | NO |
|
||||
|
||||
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
|
||||
|
||||
| MyISAM | YES | Non-transactional engine with good performance and small data footprint | NO | NO | NO |
|
||||
|
||||
| Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO |
|
||||
|
||||
| InnoDB | DEFAULT | Supports transactions, row-level locking, foreign keys and encryption for tables | YES | YES | YES |
|
||||
|
||||
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
|
||||
|
||||
| SEQUENCE | YES | Generated tables filled with sequential values | YES | NO | YES |
|
||||
|
||||
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
|
||||
|
||||
8 rows in set (0.007 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### ENGINE utilisé pour une table:
|
||||
|
||||
<u>mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = 'database';</u>
|
||||
|
||||
```bash
|
||||
MariaDB [(none)]> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = 'zenphoto';
|
||||
|
||||
+------------------+--------+
|
||||
| TABLE_NAME | ENGINE |
|
||||
+------------------+--------+
|
||||
| _menu | InnoDB |
|
||||
| .tags | InnoDB |
|
||||
| .plugin_storage | InnoDB |
|
||||
| _images | InnoDB |
|
||||
| .pages | MyISAM |
|
||||
| .menu | InnoDB |
|
||||
| _plugin_storage | InnoDB |
|
||||
| .admin_to_object | InnoDB |
|
||||
| _tags | InnoDB |
|
||||
.../...
|
||||
| .captcha | InnoDB |
|
||||
| .news | InnoDB |
|
||||
| .comments | MyISAM |
|
||||
| _admin_to_object | InnoDB |
|
||||
| _comments | InnoDB |
|
||||
| _pages | InnoDB |
|
||||
+------------------+--------+
|
||||
|
||||
32 rows in set (0.012 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Bases:
|
||||
|
||||
#### Voir toutes les bases:
|
||||
|
||||
<u>mysql> SHOW DATABASES;</u>
|
||||
|
||||
```bash
|
||||
MariaDB [(none)]> SHOW DATABASES;
|
||||
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| funnymac |
|
||||
| ghost_prod |
|
||||
| information_schema |
|
||||
| mgpt |
|
||||
| mysql |
|
||||
| performance_schema |
|
||||
| phpmyadmin |
|
||||
| piwik |
|
||||
| python |
|
||||
| ssi |
|
||||
| wordpress4 |
|
||||
| wordpress5 |
|
||||
| xhprof |
|
||||
| xhprof_gui |
|
||||
| yeswiki |
|
||||
| zenphoto |
|
||||
+--------------------+
|
||||
|
||||
16 rows in set (0.007 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Utiliser une base existante:
|
||||
|
||||
<u>mysql> USE database;</u>
|
||||
|
||||
```bash
|
||||
MariaDB [(none)]> USE ssi
|
||||
|
||||
Reading table information for completion of table and column names
|
||||
|
||||
You can turn off this feature to get a quicker startup with -A
|
||||
|
||||
|
||||
|
||||
Database changed
|
||||
|
||||
MariaDB [ssi]>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Supprimer une base:
|
||||
|
||||
<u>mysql> DROP DATABASE database</u>
|
||||
|
||||
```bash
|
||||
MariaDB [(none)]> DROP DATABASE zenphoto
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Tables:
|
||||
|
||||
#### Voir les tables de la base courante:
|
||||
|
||||
<u>mysql [database]> SHOW TABLES;</u>
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> SHOW TABLES;
|
||||
|
||||
+--------------------+
|
||||
| Tables_in_zenphoto |
|
||||
+--------------------+
|
||||
| .admin_to_object |
|
||||
| .administrators |
|
||||
| .albums |
|
||||
| .captcha |
|
||||
| .comments |
|
||||
| .images |
|
||||
.../...
|
||||
| _news |
|
||||
| _news2cat |
|
||||
| _news_categories |
|
||||
| _obj_to_tag |
|
||||
| _options |
|
||||
| _pages |
|
||||
| _plugin_storage |
|
||||
| _search_cache |
|
||||
| _tags |
|
||||
+--------------------+
|
||||
|
||||
32 rows in set (0.000 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Structure d’une table:
|
||||
|
||||
<u>mysql [database]> DESCRIBE table;</u>
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> DESCRIBE _tags;
|
||||
|
||||
+-------+------------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------+------------------+------+-----+---------+----------------+
|
||||
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
|
||||
| name | varchar(255) | NO | UNI | NULL | |
|
||||
+-------+------------------+------+-----+---------+----------------+
|
||||
|
||||
2 rows in set (0.030 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Renommer une table:
|
||||
|
||||
mysql [database]> ALTER TABLE table AS new_table;
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> ALTER TABLE _tags RENAME AS _new-tags;
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Vérification des tables :
|
||||
|
||||
<u>2 solutions:</u>
|
||||
|
||||
**1) CHECK TABLE table;**
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> CHECK TABLE _tags;
|
||||
|
||||
+----------------+-------+----------+----------+
|
||||
| Table | Op | Msg_type | Msg_text |
|
||||
+----------------+-------+----------+----------+
|
||||
| zenphoto._tags | check | status | OK |
|
||||
+----------------+-------+----------+----------+
|
||||
|
||||
1 row in set (0.043 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
**2) [mysqlcheck](https://mariadb.com/kb/en/library/mysqlcheck/)**
|
||||
|
||||
mysqlcheck verrouille chaque table en lecture seule (la base est alors inaccessible pour les autres processus pendant ce temps) pour vérification ou réparation.
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -ppassword zenphoto
|
||||
|
||||
zenphoto..admin_to_object OK
|
||||
zenphoto..administrators OK
|
||||
zenphoto..albums OK
|
||||
zenphoto..captcha OK
|
||||
zenphoto..comments OK
|
||||
zenphoto..images OK
|
||||
zenphoto..menu OK
|
||||
|
||||
.../...
|
||||
|
||||
zenphoto._news2cat OK
|
||||
zenphoto._news_categories OK
|
||||
zenphoto._obj_to_tag OK
|
||||
zenphoto._options OK
|
||||
zenphoto._pages OK
|
||||
zenphoto._plugin_storage OK
|
||||
zenphoto._search_cache OK
|
||||
zenphoto._tags OK
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Optimiser:
|
||||
|
||||
Les bases InnoDB ne supportent pas l’option OPTIMIZE.
|
||||
|
||||
A la place,MySQL crée une nouvelle table, y copie toutes les lignes, efface l’ancienne table, renomme la nouvelle et lance ANALYSE
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
mysqlcheck -u root -ppassword -o --all-databases
|
||||
|
||||
funnymac.download OK
|
||||
funnymac.downloads OK
|
||||
funnymac.eggs OK
|
||||
funnymac.ipod OK
|
||||
funnymac.ipod_news OK
|
||||
funnymac.ipod_vers OK
|
||||
funnymac.liens OK
|
||||
funnymac.livre OK
|
||||
funnymac.note OK
|
||||
funnymac.numeric_info Table is already up to date
|
||||
funnymac.numeric_log OK
|
||||
funnymac.numeric_vers OK
|
||||
funnymac.tips OK
|
||||
funnymac.truc OK
|
||||
funnymac.vote OK
|
||||
ghost_prod.accesstokens
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
|
||||
status : OK
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Réparer des tables :
|
||||
|
||||
[MySQL Server logs](https://dev.mysql.com/doc/refman/5.7/en/server-logs.html)
|
||||
|
||||
La 1ere chose à faire en cas de problèmes est de consulter les fichiers logs. Ceux-çi sont généralement avec les tables:
|
||||
|
||||
```bash
|
||||
#osx (Homebrew):
|
||||
|
||||
$ cd /usr/local/var/mysql
|
||||
total 388560
|
||||
drwxr-xr-x 32 bruno admin 1024 28 nov 16:53 .
|
||||
drwxrwxr-x 13 bruno admin 416 16 fév 2018 ..
|
||||
-rw-rw---- 1 bruno admin 16384 28 nov 08:08 aria_log.00000001
|
||||
-rw-rw---- 1 bruno admin 52 28 nov 08:08 aria_log_control
|
||||
drwx------ 48 bruno admin 1536 1 déc 17:05 funnymac
|
||||
drwx------ 53 bruno admin 1696 1 déc 17:05 ghost_prod
|
||||
-rw-r----- 1 bruno admin 15114 28 nov 08:08 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 50331648 3 déc 07:19 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 50331648 24 oct 12:51 ib_logfile1
|
||||
-rw-rw---- 1 bruno admin 79691776 3 déc 07:19 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 28 nov 16:53 ibtmp1
|
||||
drwx------ 9 bruno admin 288 1 déc 17:05 mgpt
|
||||
-rw-rw---- 1 bruno admin 0 24 jul 2017 multi-master.info
|
||||
drwx------ 89 bruno admin 2848 1 déc 17:05 mysql
|
||||
drwx------ 3 bruno admin 96 24 jul 2017 performance_schema
|
||||
drwx------ 41 bruno admin 1312 1 déc 17:05 phpmyadmi
|
||||
-rw-rw---- 1 bruno admin 1271878 3 déc 07:19 silverbook.home.err
|
||||
-rw-rw---- 1 bruno admin 5 28 nov 16:53 silverbook.home.pid
|
||||
```
|
||||
|
||||
|
||||
|
||||
<u>Pour réparer, 2 solutions:</u>
|
||||
|
||||
**1) REPAIR TABLE:**
|
||||
|
||||
- ne nécessite pas l’arrêt de MySQL
|
||||
- uniquement base MyISAM
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> REPAIR TABLE _tags;
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
| Table | Op | Msg_type | Msg_text |
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
| zenphoto._tags | repair | note | The storage engine for the table doesn't support repair |
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
|
||||
1 row in set (0.006 sec)
|
||||
```
|
||||
|
||||
Si l’erreur persiste, **vider le cache** (Flush all cache)
|
||||
|
||||
|
||||
|
||||
**2) mysqlcheck -r:**
|
||||
|
||||
- nécessite un arrêt du service MySQL
|
||||
|
||||
- uniquement base MyISAM
|
||||
|
||||
[MyISAM](https://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html):
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -ppassword -r zenphoto .comments
|
||||
|
||||
zenphoto..comments OK
|
||||
```
|
||||
|
||||
[InnoDB](https://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html):
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -ppassword -r zenphoto _tags
|
||||
|
||||
zenphoto._tags
|
||||
|
||||
note : The storage engine for the table doesn't support repair
|
||||
```
|
||||
|
||||
Pour les tables InnoDB, il faut [forcer la récupération](https://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html):
|
||||
|
||||
1) Arrêter **mysqld**:
|
||||
|
||||
2) Sauvegarder **mysql**:
|
||||
|
||||
```bash
|
||||
#Linux
|
||||
/var/lib/mysql/
|
||||
|
||||
#osx (Homebrew)
|
||||
/usr/local/var/mysql/
|
||||
```
|
||||
|
||||
3) Ajouter au fichier de configuration MySQL my.cnf:
|
||||
|
||||
```
|
||||
#osx (Homebrew): /usr/local/etc/my.cnf
|
||||
|
||||
[mysqld]
|
||||
innodb_force_recovery = 4
|
||||
```
|
||||
|
||||
4) Redémarrer **mysqld**:
|
||||
|
||||
5a) Faire un dump des tables de la base avec **SELECT ... INTO OUTFILE**:
|
||||
|
||||
```mysql
|
||||
MariaDB [zenphoto]> SELECT * FROM _tags INTO OUTFILE '/tmp/corrupted.txt';
|
||||
Query OK, 170 rows affected (0.011 sec)
|
||||
|
||||
# Pour exporter au format csv:
|
||||
MariaDB [zenphoto]> SELECT * FROM _tags INTO OUTFILE '/tmp/corrupted.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
|
||||
Query OK, 170 rows affected (0.006 sec)
|
||||
|
||||
```
|
||||
|
||||
5b) Faire. un dump de toutes les tables:
|
||||
|
||||
```bash
|
||||
$ mysqldump -A -u root -ppassword > '/tmp/dump.sql';
|
||||
```
|
||||
|
||||
6) Parfois cela peut suffire. Sinon,
|
||||
|
||||
7) Supprimer les tables / bases corrompues (DROP ...)
|
||||
|
||||
8) Arrêter **mysqld**:
|
||||
|
||||
9) Supprimer les ib*:
|
||||
|
||||
```bash
|
||||
#Linux
|
||||
/var/lib/mysql/ib*
|
||||
|
||||
#osx (Homebrew)
|
||||
/usr/local/var/mysql/ib*
|
||||
```
|
||||
|
||||
10) Quitter le mode force recovery:
|
||||
|
||||
```
|
||||
[mysqld]
|
||||
#innodb_force_recovery = 0
|
||||
```
|
||||
|
||||
11) Redémarrer **mysqld**:
|
||||
|
||||
12) Restaurer les bases:
|
||||
|
||||
```bash
|
||||
$ mysql -u root -ppassword < dump.sql
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://www.nixpal.com/mysql-innodb-corruption-repair-guide/
|
||||
|
||||
|
||||
|
||||
#### Vérifier et réparer:
|
||||
|
||||
Vérifier toutes les bases et réparer les tables corrompues:
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -p -A --auto-repair
|
||||
|
||||
Enter password:
|
||||
|
||||
funnymac.download OK
|
||||
funnymac.downloads OK
|
||||
…/…
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -557,7 +37,7 @@ funnymac.downloads OK
|
||||
|
||||
Les commandes doivent se terminer par un **;**
|
||||
|
||||
```bash
|
||||
```mysql
|
||||
MariaDB [(none)]> mysqlcheck zenphoto
|
||||
->
|
||||
-> \c
|
||||
@@ -578,12 +58,6 @@ echo "0 4 * * Sun root mysqlcheck -u maintenance --optimize --all-databases" > /
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
|
||||
|
||||
252
docs/macos/webserver/php-fpm.md
Normal file
252
docs/macos/webserver/php-fpm.md
Normal file
@@ -0,0 +1,252 @@
|
||||
# Configurer PHP ([php-fpm](https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM))(Apache 2.4+):
|
||||
|
||||
#### 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
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 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*, dé-commenter les lignes:
|
||||
|
||||
```http
|
||||
LoadModule proxy_module libexec/mod_proxy.so
|
||||
LoadModule proxy_fcgi_module libexec/mod_proxy_fcgi.so
|
||||
LoadModule rewrite_module libexec/mod_rewrite.so
|
||||
```
|
||||
|
||||
et supprimer / commenter les lignes `php_module`:
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Puis:
|
||||
|
||||
mac intel, remplacer:
|
||||
|
||||
```http
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
par
|
||||
|
||||
```http
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.php index.html
|
||||
</IfModule>
|
||||
|
||||
<VirtualHost *:*>
|
||||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/usr/local/var/www/$1"
|
||||
</VirtualHost>
|
||||
<FilesMatch \.php$>
|
||||
# 2.4.10+ can proxy to unix socket
|
||||
# SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
|
||||
# Else we can just use a tcp socket:
|
||||
SetHandler "proxy:fcgi://127.0.0.1:9000"
|
||||
</FilesMatch>
|
||||
```
|
||||
|
||||
mac M1, remplacer:
|
||||
|
||||
```http
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
par
|
||||
|
||||
```http
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.php index.html
|
||||
</IfModule>
|
||||
|
||||
<VirtualHost *:*>
|
||||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/opt/homebrew/local/var/www/$1"
|
||||
</VirtualHost>
|
||||
<FilesMatch \.php$>
|
||||
# 2.4.10+ can proxy to unix socket
|
||||
# SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
|
||||
# Else we can just use a tcp socket:
|
||||
SetHandler "proxy:fcgi://127.0.0.1:9000"
|
||||
</FilesMatch>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Changer le port:
|
||||
|
||||
```bash
|
||||
# mac M1
|
||||
$ nano /opt/homebrew/etc/php/8.0/php-fpm.d/www.conf
|
||||
|
||||
# mac intel
|
||||
$ nano /usr/local/etc/php/8.0/php-fpm.d/www.conf
|
||||
```
|
||||
|
||||
Remplacer
|
||||
|
||||
```ini
|
||||
user = _www
|
||||
group = _www
|
||||
|
||||
listen = 127.0.0.1:9000
|
||||
```
|
||||
|
||||
par
|
||||
|
||||
```ini
|
||||
user = bruno
|
||||
group = staff
|
||||
|
||||
listen = 127.0.0.1:9080
|
||||
```
|
||||
|
||||
```bash
|
||||
$ nano /opt/homebrew/etc/httpd/httpd.conf
|
||||
```
|
||||
|
||||
Remplacer
|
||||
|
||||
```http
|
||||
<VirtualHost *:*>
|
||||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/opt/homebrew/local/var/www/$1"
|
||||
</VirtualHost>
|
||||
<FilesMatch \.php$>
|
||||
# 2.4.10+ can proxy to unix socket
|
||||
# SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
|
||||
# Else we can just use a tcp socket:
|
||||
SetHandler "proxy:fcgi://127.0.0.1:9000"
|
||||
</FilesMatch>
|
||||
```
|
||||
|
||||
par
|
||||
|
||||
```http
|
||||
<VirtualHost *:*>
|
||||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9080/opt/homebrew/local/var/www/$1"
|
||||
</VirtualHost>
|
||||
<FilesMatch \.php$>
|
||||
# 2.4.10+ can proxy to unix socket
|
||||
# SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
|
||||
# Else we can just use a tcp socket:
|
||||
SetHandler "proxy:fcgi://127.0.0.1:9080"
|
||||
</FilesMatch>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Changer de version:
|
||||
|
||||
*PHP switcher script*:
|
||||
|
||||
`sphp.sh`
|
||||
|
||||
https://gist.github.com/rozsival/10289d1e2006c68009ace0478306ecd2
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
latest="8.0"
|
||||
versions=("7.4" "8.1" "$latest")
|
||||
valid=$(printf "|%s" "${versions[@]}")
|
||||
switch="$1"
|
||||
|
||||
ERROR=$(tput setaf 1)
|
||||
SUCCESS=$(tput setaf 2)
|
||||
|
||||
if [ -z "$switch" ]
|
||||
then
|
||||
echo "${ERROR}✖ PHP version required (${valid:1})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! " ${versions[@]} " =~ " ${switch} " ]]
|
||||
then
|
||||
printf "${ERROR}✖ Invalid PHP version (valid: ${valid:1})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "⇆ Switching PHP to version $switch\n\n"
|
||||
|
||||
php="php@$switch"
|
||||
if [ "$switch" == "$latest" ] ; then php="php" ; fi
|
||||
|
||||
for v in ${versions[*]}
|
||||
do
|
||||
service="php@$v"
|
||||
pattern="$service"
|
||||
if [ "$v" == "$latest" ] ; then pattern="php[^@]" ; fi
|
||||
status=$(brew services | grep "$pattern" | grep "started")
|
||||
if [ ! -z "$status" ] ; then brew services stop "$service" ; fi
|
||||
brew unlink "$service"
|
||||
done
|
||||
|
||||
brew link --overwrite --force "$php"
|
||||
brew services start "$php"
|
||||
|
||||
printf "\n${SUCCESS}✔ PHP switched to version $switch"
|
||||
exit 0
|
||||
|
||||
```
|
||||
|
||||
Installation Mac intel:
|
||||
|
||||
```bash
|
||||
# Dans /usr/local/bin/sphp
|
||||
|
||||
$ chmod +x /usr/local/bin/sphp
|
||||
```
|
||||
|
||||
Installation Mac M1:
|
||||
|
||||
```bash
|
||||
# /opt/homebrew/bin/sphp
|
||||
|
||||
$ chmod +x /opt/homebrew/bin/sphp
|
||||
```
|
||||
|
||||
Utilisation:
|
||||
|
||||
```bash
|
||||
$ sphp 7.4
|
||||
```
|
||||
|
||||
https://kevdees.com/macos-11-big-sur-nginx-setup-multiple-php-versions/
|
||||
@@ -1,6 +1,10 @@
|
||||
# Installer PHP (homebrew)
|
||||
# php
|
||||
|
||||
### Installation:
|
||||
|
||||
|
||||
### Installer PHP (homebrew)
|
||||
|
||||
#### Installation:
|
||||
|
||||
Ajouter le tap:
|
||||
|
||||
@@ -12,112 +16,36 @@ $ brew update
|
||||
Installer différentes versions de PHP:
|
||||
|
||||
```bash
|
||||
$ brew install shivammathur/php/php@7.4
|
||||
$ brew install shivammathur/php/php@7.4 # installe également la formule php@7.4
|
||||
$ brew link --overwrite --force php@7.4
|
||||
```
|
||||
|
||||
```bash
|
||||
$ brew install shivammathur/php/php@8.0
|
||||
$ brew link --overwrite --force php@8.0
|
||||
$ brew install shivammathur/php/php # installe également la formule php (8.0)
|
||||
$ brew link --overwrite --force php
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Configurer PHP:
|
||||
### Configurer php sous serveur Apache:
|
||||
|
||||
Mac intel:
|
||||
1. [mod-php](mod-php.md)
|
||||
|
||||
2. [php-fpm](php-fpm.md)
|
||||
|
||||
|
||||
|
||||
### Redémarrer PHP:
|
||||
|
||||
```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
|
||||
brew services restart shivammathur/php/php # php 8.0
|
||||
brew services restart shivammathur/php/php@7.4
|
||||
brew services restart shivammathur/php/php@8.1
|
||||
```
|
||||
|
||||
|
||||
|
||||
```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>
|
||||
```
|
||||
|
||||
Redémarrer le serveur web:
|
||||
### Redémarrer le serveur web:
|
||||
|
||||
- pour Apache (httpd): `brew services restart httpd`
|
||||
- pour Nginx: `brew services restart nginx`
|
||||
@@ -130,45 +58,14 @@ echo "<?php phpinfo();" > ~/Sites/info.php
|
||||
|
||||
et aller sur http://localhost/info.php
|
||||
|
||||
- mod-php: `Server API: Apache 2.0 Handler`
|
||||
- php-fpm: `Server API: FPM/FastCGI`
|
||||
|
||||
Si PHP n'est pas interprété, redémarrer le mac.
|
||||
|
||||
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Version de PHP:
|
||||
### Version de PHP:
|
||||
|
||||
```bash
|
||||
$ php -v
|
||||
@@ -187,7 +84,7 @@ $ php -i
|
||||
|
||||
|
||||
|
||||
#### Logs:
|
||||
### Logs:
|
||||
|
||||
```bash
|
||||
/opt/homebrew/var/log/php-fpm.log
|
||||
@@ -232,7 +129,8 @@ xdebug.mode=debug
|
||||
$ brew install apcu@8.0
|
||||
|
||||
# Fichier config
|
||||
/opt/homebrew/etc/php/8.0/conf.d/apcu.ini
|
||||
/opt/homebrew/etc/php/8.0/conf.d/apcu.ini # M1
|
||||
/usr/local/etc/php/8.0/conf.d/apcu.ini # intel
|
||||
```
|
||||
|
||||
```bash
|
||||
@@ -254,7 +152,8 @@ apc.enable_cli=1
|
||||
$ brew install imagick@8.0
|
||||
|
||||
# Fichier config
|
||||
/opt/homebrew/etc/php/8.0/conf.d/imagick.ini
|
||||
/opt/homebrew/etc/php/8.0/conf.d/imagick.ini # M1
|
||||
/usr/local/etc/php/8.0/conf.d/imagick.ini # intel
|
||||
```
|
||||
|
||||
```bash
|
||||
@@ -272,7 +171,8 @@ extension="/opt/homebrew/opt/imagick@8.0/imagick.so"
|
||||
$ brew install memcached@8.0
|
||||
|
||||
# Fichier config
|
||||
/opt/homebrew/etc/php/7.4/conf.d/memcached.ini
|
||||
/opt/homebrew/etc/php/7.4/conf.d/memcached.ini # M1
|
||||
/usr/local/etc/php/8.0/conf.d/memcached.ini # intel
|
||||
```
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user