Gestione Rimborsi Designbest: differenze tra le versioni
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
| (5 versioni intermedie di uno stesso utente non sono mostrate) | |||
| Riga 25: | Riga 25: | ||
Facciamo partire il servizio PHP5.6-FPM | Facciamo partire il servizio PHP5.6-FPM | ||
< | <syntaxhighlight> | ||
sudo systemctl start php5.6-fpm | sudo systemctl start php5.6-fpm | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Riga 33: | Riga 33: | ||
sudo a2enmod actions fcgid alias proxy_fcgi | sudo a2enmod actions fcgid alias proxy_fcgi | ||
sudo service apache2 restart | sudo service apache2 restart | ||
</syntaxhighlight> | |||
A questo punto, nel ''virtualhost'' è necessario aggiungere la direttiva '''FilesMatch''' associata all' '''handler di PHP5.6'''.<br/> | |||
La riga fondamentale è<br/> | |||
<code>SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost"</code><br/> | |||
Esempio: | |||
<syntaxhighlight lang="apache"> | |||
<VirtualHost *:80> | |||
ServerAdmin admin@site2.your_domain | |||
ServerName site2.your_domain | |||
DocumentRoot /var/www/site2.your_domain | |||
DirectoryIndex info.php | |||
<Directory /var/www/site2.your_domain> | |||
Options Indexes FollowSymLinks MultiViews | |||
AllowOverride All | |||
Order allow,deny | |||
allow from all | |||
</Directory> | |||
<FilesMatch \.php$> | |||
# For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server | |||
SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost" | |||
</FilesMatch> | |||
ErrorLog ${APACHE_LOG_DIR}/site2.your_domain_error.log | |||
CustomLog ${APACHE_LOG_DIR}/site2.your_domain_access.log combined | |||
</VirtualHost> | |||
</syntaxhighlight> | |||
Dopo aver riavviato apache verificare che il sito in questione parta con PHP5.6 inserendo un file ''info.php'' con la solita | |||
<syntaxhighlight lang="php"> | |||
<?php | |||
phpinfo(); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Versione attuale delle 15:49, 24 mar 2021
Il programma è scritto in PHP5.6 e non è compatibile con PHP7.
Siccome il server, giustamente, monta l'ultima versione di PHP, è necessario fare un paciocco per eseguire differenti versioni di PHP con Apache.
In questa guida installeremo PHP5.6 a fianco dell'ultima versione e vedremo come configurare apache per eseguire solo l'applicativo Rimborsi con PHP5.6 e lasciare invariati gli altri.
Installiamo pacchetti necessari
sudo apt-get install curl wget gnupg2 ca-certificates lsb-release apt-transport-httpsAggiungiamo i nuovi repository per poter installare le versioni FPM di PHP
wget https://packages.sury.org/php/apt.gpg
sudo apt-key add apt.gpgAggiungiamo il repository sury al nostro sistema
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php-fpm.list
sudo apt-get updateInstalliamo tutti i pacchetti necessari a far funzionare PHP5.6
sudo apt-get install php5.6 php5.6-fpm php5.6-mysql php5.6-xml libapache2-mod-php5.6 libapache2-mod-fcgidFacciamo partire il servizio PHP5.6-FPM
sudo systemctl start php5.6-fpmAbilitare i moduli necessari per apache
sudo a2enmod actions fcgid alias proxy_fcgi
sudo service apache2 restartA questo punto, nel virtualhost è necessario aggiungere la direttiva FilesMatch associata all' handler di PHP5.6.
La riga fondamentale è
SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost"
Esempio:
<VirtualHost *:80>
ServerAdmin admin@site2.your_domain
ServerName site2.your_domain
DocumentRoot /var/www/site2.your_domain
DirectoryIndex info.php
<Directory /var/www/site2.your_domain>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<FilesMatch \.php$>
# For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/site2.your_domain_error.log
CustomLog ${APACHE_LOG_DIR}/site2.your_domain_access.log combined
</VirtualHost>
Dopo aver riavviato apache verificare che il sito in questione parta con PHP5.6 inserendo un file info.php con la solita
<?php
phpinfo();