14-11-2023

This commit is contained in:
2023-11-14 20:35:51 +01:00
parent 5b45dc0863
commit d78f93eed2
93 changed files with 8181 additions and 538 deletions

View File

@@ -2,6 +2,8 @@
Version d'Apache:
```bash title="Version"
httpd24 -v
@@ -11,6 +13,8 @@ Server built: Apr 19 2021 14:41:36
Logs:
```bash title="Voir les logs"
cd /var/log/httpd/
@@ -18,3 +22,169 @@ cd /var/log/httpd/
bruno@DS916:/var/log/httpd $
```
Arrêt du serveur Apache:
```bash
$ sudo synosystemctl stop pkg-apache24
Password:
[pkg-apache24] stopped.
```
Démarrage du serveur Apache:
```bash
$ sudo synosystemctl start pkg-apache24
[pkg-apache24] started.
```
Redémarrage du serveur Apache:
```bash
$ sudo synosystemctl restart pkg-apache24
[pkg-apache24] restarted.
```
Modules activés:
```bash
$ httpd24 -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
```
Tester la configuration:
```bash
$ httpd24 -t
l: httpd24: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
AH00316: WARNING: MaxRequestWorkers of 150 is not an integer multiple of ThreadsPerChild of 32, decreasing to nearest multiple 128, for a maximum of 4 servers.
Syntax OK
```
Configuration des VirtualHosts:
```bash
$ httpd24 -S
VirtualHost configuration:
*:443 127.0.0.1 (/usr/local/etc/apache24/conf/httpd24.conf:99)
*:80 127.0.0.1 (/usr/local/etc/apache24/conf/httpd24.conf:99)
ServerRoot: "/usr/local/etc/apache24"
Main DocumentRoot: "/usr/htdocs"
```
Configuration:
```bash
$ httpd24 -V
Server version: Apache/2.4.51 (Unix)
Server built: Jan 5 2022 15:16:28
Server's Module Magic Number: 20120211:118
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D BIG_SECURITY_HOLE
-D SECURITY_HOLE_PASS_AUTHORIZATION
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="local/etc/apache24/conf/mime.types"
-D SERVER_CONFIG_FILE="local/etc/apache24/conf/httpd24.conf"
```
Aide:
```bash
$ httpd24 -h
Usage: httpd24 [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t -D DUMP_INCLUDES: show all included configuration files
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
```
Fichiers de configuration:
```bash
bruno@DS916:/usr/local/etc/apache24 $ l
total 24
drwxr-xr-x 6 root root 4096 Feb 23 06:30 .
drwxr-xr-x 21 root root 4096 May 4 08:17 ..
lrwxrwxrwx 1 root root 58 Feb 23 06:30 conf -> /var/packages/Apache2.4/target/usr/local/etc/apache24/conf
drwxr-xr-x 2 root root 4096 Dec 10 11:50 conf-available
drwxr-xr-x 2 root root 4096 Dec 10 11:50 conf-enabled
lrwxrwxrwx 1 root root 58 Feb 23 06:30 logs -> /var/packages/Apache2.4/target/usr/local/etc/apache24/logs
lrwxrwxrwx 1 root root 52 Feb 23 06:30 modules -> /var/packages/Apache2.4/target/usr/local/lib/modules
lrwxrwxrwx 1 root root 57 Feb 23 06:30 run -> /var/packages/Apache2.4/target/usr/local/etc/apache24/run
drwxr-xr-x 2 root root 4096 Jun 30 2021 sites-available
drwxr-xr-x 2 root root 4096 Jul 16 2021 sites-enabled
```
Dossiers des modules:
```bash
bruno@DS916:/usr/local/etc/apache24/modules $ l
total 3284
drwxr-xr-x 1 root root 3570 Jan 5 08:21 .
drwxr-xr-x 1 root root 14 Jan 5 08:21 ..
-rwxr-xr-x 1 root root 10456 Jan 5 08:21 mod_access_compat.so
-rwxr-xr-x 1 root root 10456 Jan 5 08:21 mod_actions.so
-rwxr-xr-x 1 root root 18744 Jan 5 08:21 mod_alias.so
-rwxr-xr-x 1 root root 10392 Jan 5 08:21 mod_allowmethods.so
...
```

View File

@@ -255,3 +255,24 @@ $ sudo dpkg -i bat_0.18.3_amd64.deb
$ sudo dpkg -i --force-bad-verify bat_0.18.3_amd64.deb
```
Désinstaller un paquet debian:
```bash
$ sudo dpkg -r bat
```
Statut d'un paquet:
```bash
$ sudo dpkg -l '*bat*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-==================================
ii bat 0.19.0 amd64 cat(1) clone with wings.
un bat-musl <none> <none> (no description available)
```
ii dans la 1ere colonne: correctement installé

View File

@@ -2,16 +2,66 @@
Le paquet [gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk) n'a pas été mis à jour pour DSM7. Il faut donc installer Gitea d'après les [binaires](https://docs.gitea.io/en-us/install-from-binary/).
Le paquet [gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk) a été mis à jour pour DSM7. Il est dispo chez [SynoCommunity](https://synocommunity.com/package/gitea).
Sinon, on peut installer Gitea d'après les [binaires](https://docs.gitea.io/en-us/install-from-binary/).
### Installation:
### Installation (paquet):
```bash
bruno@DS916:/var/packages/gitea/var $ l
total 1672
drwxr-xr-x 1 sc-gitea synocommunity 66 May 7 10:46 .
drwxr-xr-x 1 root root 648 May 6 16:26 ..
-rw------- 1 sc-gitea synocommunity 1790 May 7 10:47 conf.ini
drwxr-xr-x 1 sc-gitea synocommunity 150 May 8 17:14 data
-rw-r--r-- 1 sc-gitea synocommunity 1701804 May 8 19:23 gitea.log
-rw-r--r-- 1 sc-gitea synocommunity 5 May 7 10:47 gitea.pid
drwxr-xr-x 1 sc-gitea synocommunity 0 May 7 10:46 log
```
```bash
git push -u gitea916 master
💡 gp -u gitea916 master
Username for 'https://clicclac.synology.me:3000': bruno
Password for 'https://bruno@clicclac.synology.me:3000':
```
`git config credential.helper store`
Aide pour stocker les informations didentification sur disque (en clair)(seules les permissions du fichiers .git-credentials protègent)
https://techexpertise.medium.com/storing-git-credentials-with-git-credential-helper-33d22a6b5ce7
```bash
~ $ bat .git-credentials
File: .git-credentials
1 https://bruno:%yy%xxxxxxx%yyz@clicclac.synology.me%3a3000
```
Sur macOS, on peut stocker stocker les informations didentification dans la keychain (encrypté)
`git config --global credential.helper osxkeychain`
### Installation (binaires):
Créer un utilisateur `gitea`.
```bash
bruno@DS916:~ $ sudo su - gitea
gitea@DS916:~$
```
Déclarer le répertoire d'installation dans `.bashrc`:
```
export GITEA_WORK_DIR=/var/services/homes/bruno/gitea
export GITEA_WORK_DIR=/var/services/homes/gitea
```
Préparer les répertoires:
@@ -19,21 +69,19 @@ Préparer les répertoires:
```bash
# dossier d'installation
mkdir -p $GITEA_WORK_DIR/{custom,data,log}
#chown -R git:git $GITEA_WORK_DIR/
chown -R bruno:users $GITEA_WORK_DIR/
chown -R gitea:users $GITEA_WORK_DIR/
chmod -R 750 $GITEA_WORK_DIR/
# dossier de configuration
mkdir /etc/gitea
#chown root:git /etc/gitea
chown bruno:users /etc/gitea
chown gitea:users /etc/gitea
chmod 770 /etc/gitea
```
Télécharger Gitea
```bash
wget -O gitea https://dl.gitea.io/gitea/1.15.4/gitea-1.15.4-linux-amd64
wget -O gitea https://dl.gitea.io/gitea/1.16.6/gitea-1.16.6-linux-amd64
chmod +x gitea
mv gitea /usr/local/bin/
```
@@ -41,11 +89,22 @@ mv gitea /usr/local/bin/
Lancer Gitea
```bash
gitea web
GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
gitea@DS916:~$ /usr/local/bin/gitea web -c /etc/gitea/app.ini
```
Erreur *'bind: address already in use'*:
```bash
$ netstat -tulpn
tcp6 0 0 :::3000 :::* LISTEN 9829/gitea
$ kill 9829
```
Configurer gitea:
http://192.168.2.7:3000
### Configuration:
@@ -114,13 +173,13 @@ chmod 640 /etc/gitea/app.ini
Les repos sont stockés ici:
```bash
ROOT = /var/services/homes/bruno/gitea/data/gitea-repositories
ROOT = /var/services/homes/gitea/data/gitea-repositories
```
et les logs là:
```bash
ROOT_PATH = /var/services/homes/bruno/gitea/log
ROOT_PATH = /var/services/homes/gitea/log
```
@@ -226,6 +285,11 @@ WantedBy=multi-user.target
```
```bash
bruno@DS916:/etc/gitea $ cd /etc/systemd/system
-rw-r--r-- 1 root root 2192 Oct 8 2021 gitea.service
```
```bash title="Activer le service gitea au démarrage"
@@ -246,6 +310,17 @@ bruno 8220 0.8 6.2 2038820 122672 ? Ssl 20:26 0:02 /usr/local/bin/
bruno 9790 0.0 0.0 2860 184 pts/1 D+ 20:32 0:00 grep gitea
```
```bash
gitea@DS916:~ $ systemctl status gitea.service
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-05-04 19:32:00 CEST; 15h ago
Main PID: 16222 (gitea)
Memory: 39.2M
CGroup: /system.slice/gitea.service
└─16222 /usr/local/bin/gitea web --config /etc/gitea/app.ini
```
### Mise-à-jour
@@ -319,3 +394,67 @@ fi
exit 1
```
### Personnaliser:
https://docs.gitea.io/en-us/customizing-gitea/
```bash
$ gitea embedded list | grep 'login'
```
#### Ajouter un lien dans la barre de navigation:
```bash
# Ajouter un fichier extra_links.tmpl
$ nano /var/services/homes/gitea/custom/templates/custom/extra_links.tmpl
<a class="item" href="https://maboiteverte.fr">maboiteverte.fr</a>
# Redémarrer Gitea
$ sudo service gitea restart
```
#### Ajouter un lien dans la barre de navigation inférieure:
```bash
# Ajouter un fichier extra_links_footer.tmpl
$ nano /var/services/homes/gitea/custom/templates/custom/extra_links_footer.tmpl
<a class="item" href="{{AppSubUrl}}/privacy.html">Privacy Policy</a>
$ cd /var/lib/gitea/custom/public
privacy.html
# Redémarrer Gitea
$ sudo service gitea restart
```
### Backup
Pour sqlite:
```bash
bruno@DS916:/var/services/homes $zip -r gitea.zip gitea/
```
Les repos sont là `/var/services/homes/gitea/data/gitea-repositories`
Pour MySQL, sauvegarder la base en plus.
Gitea ajoute dans le `authorized_keys`:
```
#command="/usr/local/bin/gitea --config=/etc/gitea/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+V9iatTyPN/4prnbnRhUdP13RMTSPeajqvpyJzcNmVGUeGLOT6zCY4RQQAbd1ZCRWNZ3W/OmjiQ0a2r1yp26pxJlS9UWl8DUGc3D7StGAbHpP20ydZ++VvXCcqbAgpuPnScmWCzk/flPzcDiFOGwo2fh5bHGjO+XjOVaIhP608cMkw8UR2Dcg+BkOuBb5oX9SScvb2U5elosMbsDSR+Hghip4Wf8QFYyCJxpgZXjEucp0rm5fe19mKL/bF3PLS3OqUgN24WZv7jdDTK/QICz+cCHU8cG8+A4MYkdBaMZysXIJtdk5MzLbRhaD6yohP403MxA3BrMCGPXnk9cHi4JQ1meClP0OiyrPaC36iX7tvtszzFbnjmElHYmMTSWp0sstMfWt+7nIDJMbxOee3g5MUu1AbHrNyds4DiP4AKy25t9q8TMSYWPN8M84N5sUIKao9SUeHLLU7BoqiSJTpHuIS4967ETdkunu7OipKEueUXjxA4WK+qp3KCa+lGncTkog72DN6j8kR86H/rfW+b2KqKj4vQr9Covd+W9WoC2e558qHlqWKY8B1Wh/kt5oo+4paw7yBgkGS3hsHBdd+uzG0y5BL7DiUDdC45I71oSTsOqBosW9mtEA4d9cmeQjjrVFGlSWpfD6+46MGn9uyOp7W5ndpHJe1iorAmdl2nTcbw== Commentaire: ma clé sur le airbook
```

View File

@@ -26,3 +26,8 @@ https://blog.viking-studios.net/en/nextcloud-hub-optimization-on-a-synology-disk
apc.enable_cli=1
```
Erreur Nextcloud dans les logs *Exception: Call to undefined function OCA\Settings\Controller\posix_getuid() in file*:
L'extension PHP Posix n'est pas installée.

View File

@@ -2,16 +2,30 @@
#### Paquets Synology
```bash
bruno@DS916:/volume1/@appstore/Node.js_v18/usr/local $ cd bin/
total 47520
drwxr-xr-x 1 root root 30 Oct 26 2022 .
drwxr-xr-x 1 root root 18 Oct 26 2022 ..
lrwxrwxrwx 1 root root 45 Oct 26 2022 corepack -> ../lib/node_modules/corepack/dist/corepack.js
-rwxr-xr-x 1 root root 48651256 Oct 26 2022 node
lrwxrwxrwx 1 root root 38 Oct 26 2022 npx -> ../lib/node_modules/npm/bin/npx-cli.js
```
### Installer nvm
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
```
Installer node=lts/fermium (ou mettre-à-jour)
```bash
nvm install --lts=fermium
nvm install --lts=hydrogen
```
Mettre-à-jour npm:

269
docs/Synology/dsm7/php.md Normal file
View File

@@ -0,0 +1,269 @@
# php
Le paquet **php 8.0** est dispo:
https://www.synology.com/fr-fr/support/download/DS916+?version=7.0#packages
#### Les services **php** actifs:
```bash
$ systemctl | grep PHP
pkg-WebStation-php74@182b445b-6caf-469f-acaa-a763582ba8db.service loaded active running WebStation PHP7.4 fpm process
pkg-WebStation-php74@da937888-3180-4a69-96d6-076b750f2b06.service loaded active running WebStation PHP7.4 fpm process
pkg-WebStation-php74@e32d3cf6-055c-43f0-802d-6b72e9437f42.service loaded active running WebStation PHP7.4 fpm process
pkg-WebStation-php80@746b57c5-03a4-4210-bf14-1d7df30c8b79.service loaded active running WebStation PHP8.0 fpm process
pkgctl-PHP7.4.service loaded active exited PHP7.4's service unit
pkgctl-PHP8.0.service loaded active exited PHP8.0's service unit
PHP7.3.slice loaded active active PHP7.3.slice
PHP7.4.slice loaded active active PHP7.4's slice
PHP8.0.slice loaded active active PHP8.0's slice
```
#### Les services **apache** actifs:
```bash
$ systemctl | grep apache
pkg-apache24.service loaded active running Apache2.4 daemon
```
#### Redémarrer un service:
```bash
$ sudo systemctl restart pkgctl-PHP8.0.service
```
```bash
$ sudo systemctl stop pkgctl-PHP8.0.service
$ sudo systemctl start pkgctl-PHP8.0.service
```
#### Mettre PHP 8.0 cli par défaut:
```bash
$ sudo -i
Password:
root@DS916:~# cd /usr/bin/
root@DS916:/usr/bin# mv php php73
root@DS916:/usr/bin# ln -s /volume1/@appstore/PHP8.0/usr/local/bin/php80 php
root@DS916:/usr/bin# php -v
PHP 8.0.17 (cli) (built: Mar 22 2022 17:54:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.17, Copyright (c) Zend Technologies
```
#### Liste des php.ini:
```bash
$ find / -name php.ini 2>/dev/null
/usr/local/etc/php73/cli/php.ini
/usr/local/etc/php80/cli/php.ini memory_limit = 512M
/usr/local/etc/php74/cli/php.ini memory_limit = 128M
/etc.defaults/php/php.ini memory_limit = 128M
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
/volume1/@appstore/PHP7.2/usr/local/etc/php72/cli/php.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini memory_limit = 128M
/volume1/@appstore/PHP8.0/usr/local/etc/php80/cli/php.ini memory_limit = 512M
/etc/php/php.ini memory_limit = 512M
/volume1/@appstore/PHP8.0/misc/php-fpm.ini <- memory_limit pris en compte par php-info memory_limit = 512M
```
### PHP 8.0
#### Liste des fichiers de conf:
```bash
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php80/cli
Loaded Configuration File: /usr/local/etc/php80/cli/php.ini
Scan for additional .ini files in: /usr/local/etc/php80/cli/conf.d
Additional .ini files parsed: /usr/local/etc/php80/cli/conf.d/extension.ini,
/usr/local/etc/php80/cli/conf.d/nextcloud.ini,
/usr/local/etc/php80/cli/conf.d/timezone.ini
```
```bash
bruno@DS916:~ $ cd /usr/local/etc/php80/cli/conf.d
total 20
-rw-r--r-- 1 root root 773 May 4 08:17 extension.ini
-rw-r--r-- 1 root root 68 May 4 09:48 nextcloud.ini
-rw-r--r-- 1 root root 32 May 4 08:17 timezone.ini
```
#### Erreur Nextcloud *OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache*:
Il faut rajouter l'extension apcu mais elle n'est pas dispo dans le profil PHP.
```bash
bruno@DS916:/usr/local/etc/php80/cli/conf.d $ cat nextcloud.ini
extension = apcu.so
[apc]
apc.shm_size = 512M
apc.enable_cli = 1
```
#### Liste des modules PHP:
```bash
$ php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mailparse
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib
[Zend Modules]
```
#### Dossier des modules:
`/volume1/@appstore/PHP8.0/usr/local/lib/php80/modules/`
`/volume1/@appstore/PHP7.4/usr/local/lib/php74/modules/`
Les extensions n'apparaissent pas dans les <u>Extensions du profil PHP</u> (Web Station). Il faut éditer `extension_list.json`:
```bash
$ sudo nano /volume1/@appstore/PHP8.0/misc/extension_list.json
"apcu": {
"enable_default": true,
"desc": "APC User Cache."
},
"redis": {
"enable_default": true,
"desc": "The php redis extension provides an API for communicating with the Redis key-value store.."
},
```
#### Installer Composer:
On se place dans /usr/local/bin:
```bash
bruno@DS916:~ $ cd /usr/local/bin
```
et on installe Composer:
```bash
bruno@DS916:/usr/local/bin $ sudo curl -s http://getcomposer.org/installer | sudo php80
Password:
All settings correct for using Composer
Downloading...
Composer (version 2.5.7) successfully installed to: /usr/local/bin/composer.phar
Use it: php composer.phar
```
Pour l'appeler directement, on crée un script:
```bash
bruno@DS916:/usr/local/bin $ sudo nano composer
```
```bash
#!/bin/bash
php /usr/local/bin/composer.phar $*
```
```bash
bruno@DS916:/usr/local/bin $ sudo chmod --reference=composer.phar composer
```
```bash
bruno@DS916:/usr/local/bin $ composer --version
Composer version 2.5.7 2023-05-24 15:00:39
```

View File

@@ -41,12 +41,12 @@ Activer **Redis** dans PHP:
Redis n'est pas proposé dans les extensions, bien que le module soit présent..
```bash
ls /volume1/@appstore/PHP7.3/usr/local/lib/php73/modules/redis.so
/volume1/@appstore/PHP7.3/usr/local/lib/php73/modules/redis.so
ls /volume1/@appstore/PHP8.0/usr/local/lib/php80/modules/redis.so
/volume1/@appstore/PHP8.0/usr/local/lib/php80/modules/redis.so
```
```bash title="Editer le fichier extension.ini"
sudo nano /usr/local/etc/php73/cli/conf.d/extension.ini
sudo nano /usr/local/etc/php80/cli/conf.d/extension.ini
# Ajouter la ligne extension = redis.so juste après posix.po
```
@@ -65,3 +65,22 @@ sudo nano /volume1/@appstore/PHP7.3/misc/extension_list.json
**Redis** est maintenant disponible dans les extensions PHP. On l'active.
### Nextcloud:
A ajouter dans le fichier de configuration `/volume1/web/nextcloud/config/config.php`:
```php
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'memcache.local' => '\\OC\\Memcache\\APCu',
'redis' =>
array (
'host' => '/sockets/redis.socket',
'port' => 0,
'password' => '[PASSWORD]',
'timeout' => 1.5,
),
```

View File

@@ -0,0 +1,172 @@
# Installer Apache/PHP via opkg (Entware)
### Apache
```
```
#### Configuration:
```bash
sudo nano /opt/etc/apache2/apache2.conf
```
```http
Listen 81
User http
Group http
ServerName clicclac.synology.me:81
<IfModule dir_module>
DirectoryIndex index.html index.php
</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>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DocumentRoot "/opt/share/apache2/htdocs"
```
```bash
sudo /opt/etc/init.d/S80apache restart
```
#### Liste des modules:
```bash
apachectl -M
```
### PHP
#### Installer PHP 8.2:
```bash
sudo opkg install php8 php8-cgi php8-cli php8-fastcgi
```
```bash
/opt/etc $ cd init.d/
total 16
drwxr-xr-x 1 root root 74 May 29 07:40 .
drwxr-xr-x 1 root root 390 Feb 27 08:44 ..
-rw-r--r-- 1 root root 2822 Apr 19 2021 rc.func
-rwxr-xr-x 1 root root 966 Apr 19 2021 rc.unslung
-rwxr-xr-x 1 root root 241 Feb 27 08:44 S79php8-fpm
lrwxrwxrwx 1 root root 19 May 29 07:40 S80apache -> /opt/sbin/apachectl
```
#### Installer des modules PHP:
```bash
sudo opkg install php8-mod-bcmath php8-mod-ctype php8-mod-curl php8-mod-dom php8-mod-exif php8-mod-fileinfo php8-mod-filter php8-mod-ftp php8-mod-gd php8-mod-gettext php8-mod-gmp php8-mod-iconv php8-mod-imap php8-mod-intl
icu-full-data php8-mod-mbstring php8-mod-mysqli php8-mod-mysqlnd php8-mod-opcache php8-mod-openssl php8-mod-pcntl php8-mod-pdo php8-mod-pdo-mysql php8-mod-pdo-sqlite php8-mod-phar php8-mod-session php8-mod-sysvsem php8-mod-tokenizer php8-mod-xml php8-mod-xmlwriter php8-mod-zip php8-pecl-imagick php8-pecl-redis
```
#### PHP via opkg:
```bash
/opt/bin
-rwxr-xr-x 1 root root 4322256 Feb 27 08:44 php8-cgi
-rwxr-xr-x 1 root root 4392192 Feb 27 08:44 php8-cli
lrwxrwxrwx 1 root root 8 May 29 09:50 php8-fcgi -> php8-cgi
-rwxr-xr-x 1 root root 4439296 Feb 27 08:44 php8-fpm
lrwxrwxrwx 1 root root 8 May 29 09:50 php-cgi -> php8-cgi
lrwxrwxrwx 1 root root 8 May 29 08:05 php-cli -> php8-cli
lrwxrwxrwx 1 root root 9 May 29 09:50 php-fcgi -> php8-fcgi
```
#### Paquet Synology PHP:
```bash
/usr/local/bin
lrwxrwxrwx 1 root root 47 May 28 09:22 php80 -> /var/packages/PHP8.0/target/usr/local/bin/php80
lrwxrwxrwx 1 root root 51 May 28 09:22 php80-cgi -> /var/packages/PHP8.0/target/usr/local/bin/php80-cgi
lrwxrwxrwx 1 root root 51 May 28 09:22 php80-fpm -> /var/packages/PHP8.0/target/usr/local/bin/php80-fpm
```
#### Démarrer PHP
```bash
bruno@DS916:/opt/etc/init.d $ ./S79php8-fpm start
Starting php8-fpm... done.
```
#### Statut de PHP
```bash
bruno@DS916:/opt/etc/init.d $ ./S79php8-fpm status
Usage: ./S79php8-fpm (start|stop|restart|check|kill|reconfigure)
```
#### Configuration:
```bash
sudo nano /opt/etc/php.ini
```
```ini
post_max_size = 500M
display_errors = Off
error_log = /opt/var/log/php_errors.log
output_buffering = Off
; Resource Limits
max_execution_time = 30 ; Maximum execution time of each script, in seconds.
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data.
;max_input_nesting_level = 64
memory_limit = 32M ; Maximum amount of memory a script may consume.
; Paths and Directories
;doc_root = "/opt/share/www/lighttpd"
;user_dir =
extension_dir = "/opt/lib/php"
enable_dl = On
;cgi.force_redirect = 1
;cgi.nph = 1
;cgi.redirect_status_env = ;
cgi.fix_pathinfo=1
; File Uploads
file_uploads = O
upload_tmp_dir = "/opt/tmp"
upload_max_filesize = 500M
max_file_uploads = 50
```
#### Apache:
```bash
/opt/lib/apache2/libphp.so
```