History of Webstack - PHP84 Protection
<p>With openSUSE having switched to php8.5, there is a need to provide a copy of php8.4.20. The files for these have been duplicated to /opt/php84 so that needs copying to the server. Then since the default location of the php.ini file used is hard coded into the executables, switching to the matching php.ini needs a little help, and environment variables can be set to override the default.</p>
<pre>
/opt/php84/bin/php
/opt/php84/bin/php-cgi
/opt/php84/bin/php-config
/opt/php84/bin/phpize
/opt/php84/sbin/php-fpm
/opt/php84/extensions/ -> the .so files</pre>
<p>In order to run 'php84' we can select the correct ini files. The base php.ini and the extensions ini files both need overriding.</p>
<pre>
Environment=PHPRC=/etc/webstack/php84
Environment=PHP_INI_SCAN_DIR=/etc/webstack/php84/conf.d</pre>
<p>Checking the servers we need to pull latest configuration from desktop - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">git pull</span></span><br />
and then the copy can be tested using. But first we need to create the tmp file that the php8.4 copy will use.</p>
<pre>
md /srv/tmp/php84
PHP_INI_SCAN_DIR = /etc/webstack/php84/conf.d PHPRC=/etc/webstack/php84 /opt/php84/bin/php --ini</pre>
<p>link the new php84-fpm.service - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo ln -s /etc/webstack/systemd/php84-fpm.service /etc/systemd/system/php84-fpm.service</span></span><br />
load new php84-fpm.service into systemd - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo systemctl deamon-reload</span></span><br />
And if everything else is in place it can be started by - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo systemctl start php84-fpm</span></span></p>
<p>Then the vhosts files can be updated to switch the copy of php-fpm being used, in this case to php84-php, but since we are relying on git to provide the actual files, this needs to be actioned on the desktop machine and then after committing to git it can be pushed to both servers.</p>
<pre>
sed -i 's|php-fpm.sock|php84-fpm.sock|g' /etc/webstack/nginx/vhosts.d/*.conf</pre>
<p>Then on both servers nginx can be checked and restarted<br />
<span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">nginx -t</span></span> <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">systemctl restart nginx</span></span> Checking that on srv9 first and confirming https://rdm1.uk:8443/phpinfo.php shows php using the right ini sources before repeating on srv10.</p>
<pre>
/opt/php84/bin/php
/opt/php84/bin/php-cgi
/opt/php84/bin/php-config
/opt/php84/bin/phpize
/opt/php84/sbin/php-fpm
/opt/php84/extensions/ -> the .so files</pre>
<p>In order to run 'php84' we can select the correct ini files. The base php.ini and the extensions ini files both need overriding.</p>
<pre>
Environment=PHPRC=/etc/webstack/php84
Environment=PHP_INI_SCAN_DIR=/etc/webstack/php84/conf.d</pre>
<p>Checking the servers we need to pull latest configuration from desktop - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">git pull</span></span><br />
and then the copy can be tested using. But first we need to create the tmp file that the php8.4 copy will use.</p>
<pre>
md /srv/tmp/php84
PHP_INI_SCAN_DIR = /etc/webstack/php84/conf.d PHPRC=/etc/webstack/php84 /opt/php84/bin/php --ini</pre>
<p>link the new php84-fpm.service - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo ln -s /etc/webstack/systemd/php84-fpm.service /etc/systemd/system/php84-fpm.service</span></span><br />
load new php84-fpm.service into systemd - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo systemctl deamon-reload</span></span><br />
And if everything else is in place it can be started by - <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">sudo systemctl start php84-fpm</span></span></p>
<p>Then the vhosts files can be updated to switch the copy of php-fpm being used, in this case to php84-php, but since we are relying on git to provide the actual files, this needs to be actioned on the desktop machine and then after committing to git it can be pushed to both servers.</p>
<pre>
sed -i 's|php-fpm.sock|php84-fpm.sock|g' /etc/webstack/nginx/vhosts.d/*.conf</pre>
<p>Then on both servers nginx can be checked and restarted<br />
<span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">nginx -t</span></span> <span style="font-family:monospace"><span style="background-color:#ffffff; color:#000000">systemctl restart nginx</span></span> Checking that on srv9 first and confirming https://rdm1.uk:8443/phpinfo.php shows php using the right ini sources before repeating on srv10.</p>
