SLES‐15‐Frontend‐Preparations - hbz/to.science GitHub Wiki
Add software repositories for php56:
PHP 5.6 for SLES 15.3 from here
PHP 5.6 for SLES 15.4 from here
PHP 5.6 for SLES 15.5 from here
Achtung ! Für SLES 15.6 wird PHP5 von zippy nicht mehr unterstützt.
php56-fpm = fastcgi process manager for php.
Use YaST2 to install:
php56, php56-curl, php56-devel, php56-dom, php56-fastcgi, php56-fpm, php56-gd, php56-intl, php56-json, php56-mbstring, php56-mysql, php56-openssl, php56-pdo .
sudo systemctl stop apache2
sudo cp /etc/php56/fpm/php-fpm.conf.default /etc/php56/fpm/php-fpm.conf
Make the following changes to php-fpm.conf in a production setting:
diff php-fpm.conf.default php-fpm.conf
149,150c149,152
< user = nobody
< group = nobody
---
> ;user = toscience
> ;group = users
> user = wwwrun
> group = wwwrun
164c166
< listen = 127.0.0.1:9000
---
> listen = 127.0.0.1:10000
176a179,180
> listen.owner = wwwrun
> listen.group = wwwrun
230c235
< ;pm = statuc
---
> pm = dynamic
241c246
< pm.max_children = 5
---
> pm.max_children = 256
246c251
< pm.start_servers = 2
---
> pm.start_servers = 56
251c256
< pm.min_spare_servers = 1
---
> pm.min_spare_servers = 32
256c261
< pm.max_spare_servers = 3
---
> pm.max_spare_servers = 128
261c266
< ;pm.process_idle_timeout = 10s;
---
> pm.process_idle_timeout = 10s;
366c371
< ;pm.status_path = /status
---
> pm.status_path = /statuscd /etc/php56/conf.d
cp dom.ini fpm.ini
vim fpm.ini
extension=fpm.so
wq
Also configure /etc/php56/fpm/php.ini properly. Especially increase the following values to
output_buffering = 4096
max_execution_time = 1800
memory_limit = 4096M
post_max_size = 1024M
upload_max_filesize = 2048M
max_file_uploads = 20cd /etc/systemd/system
mv /usr/lib/systemd/system/php56-fpm.service .
sudo systemctl daemon-reload
sudo systemctl start php56-fpm.service
sudo systemctl enable —now php56-fpm
Is the service listening to port 10000 ?
ss -lnpt | grep 10000
sudo zypper install apache2-event
sudo zypper install apache2-mod_fcgid
sudo zypper remove apache2-prefork
sudo zypper remove apache2-mod_php56
vim /etc/sysconfig/apache2
APACHE_MODULES="setenvif proxy proxy_fcgi fcgid" # those must be included
APACHE_MPM="event"Edit mod_fcgid.conf
Edit /etc/apache2/conf.d/mod_fcgid.conf
Add the following content at the end:
<IfModule fcgid_module>DirectoryIndex index.php <FilesMatch "\.php$"> SetHandler "proxy:fcgi://127.0.0.1:10000/" #CGIPassAuth on </FilesMatch> </IfModule>
sudo a2enmod proxy_http
sudo a2enmod proxy
sudo a2enmod proxy_fcgi
sudo a2enmod setenvif
sudo a2enmod fcgid
sudo a2enmod rewriteIf not already running, start mariadb
sudo systemctl start mariadbRestart services
sudo systemctl restart php56-fpmsudo systemctl restart apache2
In /etc/apache2/vhosts.d/ create a file site.conf or site.ssl.conf, if not yet present.
Add the following contents:
<VirtualHost *:80> ServerName localhost ServerAdmin admin@localhost DocumentRoot /opt/toscience/drupalErrorLog /var/log/apache2/localhost-error_log CustomLog /var/log/apache2/localhost-access_log combined<Directory "/"> Options FollowSymLinks AllowOverride None </Directory><Directory "/opt/toscience/drupal"> Options Indexes FollowSymLinks AllowOverride All RewriteCond %{REQUEST_URI} !^server_status Require all granted </Directory></VirtualHost>
Create a file /opt/toscience/drupal/info.php with the following content:
<?php phpinfo(); ?>Restart apache2
systemctl restart apache2Point your browser to http://localhost/info.php . You should reach a page “PHP Version 5.6.40” with precise installation details.