Changes

From SME Server
Jump to navigationJump to search
no edit summary
Line 1: Line 1: −
{{WIP box}}
+
{{Note box|Please see the '''[[PHP_Software_Collections|PHP-scl contribs page]]''' for a contrib that fully automates the installation of a PHP version. The below info is based on manual installation.}}
 +
<blockquote style="float: right;">
 +
[[File:softwarecollections.png|100px]]
 +
</blockquote>
 +
<blockquote style="float: right;">
 +
[[File:Php.jpg|200px]]
 +
</blockquote>
 +
 
 +
{{warning box| Please check the following site for notes on EOL for different versions of PHP. As of May 2019 the minimum supported version of PHP is 7.1 but only for security updates until 30th November 2019
 +
https://www.php.net/supported-versions.php
 +
 
 +
Note that the default installed version of PHP on Koozali SME is 5.3.3 and that is supported for security updates by RedHat only until the distro goes EOL. However, it may not be supported by applications.}}
 +
 
 +
===== run php54 on a hosted website (virtual host) =====
 +
Install php54 from scl repo
 +
yum --enablerepo=scl-php54 install php54-php.x86_64 
 +
 
 +
Verify the installation,
 +
  scl enable php54 'php -v'
 +
It should return this version (or higher)
 +
PHP 5.4.16 (cli) (built: Jul 10 2014 10:06:38)
 +
 
 +
Create a template fragment that will enable apache to invoke php54 for a virtual domain
 +
nano /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/70php54
 +
 
 +
paste this code fragment (including the last empty line):
 +
<nowiki>{
 +
  use esmith::DomainsDB;
 +
  my $domains = esmith::DomainsDB->open_ro;
 +
if (($domains->get_prop($virtualHost, 'php54') || 'disabled')
 +
        eq 'enabled')
 +
{
 +
$OUT = "    #Enable php54 through Cgi-Bin wrapper. Needs a wrapper script in /cgi-bin/php54-wrapper\n";
 +
$OUT .= "    AddHandler php-cgi .php\n";
 +
$OUT .= "    Action php-cgi /cgi-bin/php54-wrapper\n";
 +
$OUT .= "    <Location />\n";
 +
$OUT .= "      Options +ExecCGI\n";
 +
$OUT .= "    </Location>\n";
 +
}
 +
}
 +
</nowiki>
 +
and Save with <CTRL>-X - yes.
 +
 
 +
Create the cgi-wrapper script:
 +
nano ~<Ibayname of MyVirtualDomain>/../cgi-bin/php54-wrapper
 +
 
 +
Insert this code fragment:
 +
#!/bin/bash
 +
source /opt/rh/php54/enable
 +
exec php-cgi
 +
and Save with <CTRL>-X - yes.
 +
 
 +
Then execute these commands:
 +
cd ~<Ibayname of MyVirtualDomain>/../cgi-bin/
 +
restorecon -RF php54-wrapper
 +
chown www:www php54-wrapper
 +
chmod ugo-rwx php54-wrapper
 +
chmod ug+rx php54-wrapper
 +
 
 +
The template fragment for httpd.conf needs a database setting to be enabled for the (virtual) domain.
 +
 
 +
Check with
 +
db domains show <myVirtualDomain.com>
 +
Edit with
 +
db domains setprop <myVirtualDomain.com> php54 enabled
 +
 
 +
To enable this run:
 +
expand-template /etc/httpd/conf/httpd.conf
 +
/etc/init.d/httpd-e-smith restart
 +
 
 +
Notes:
 +
*This version of php uses the /opt/rh/php54/root/etc/php.ini file which uses default settings as configured by RedHat, use at your own risk. Adjust the settings according to your (security) needs.
 +
*Using Cgi-Bin wrapper scripts makes your system vulnerable to [https://www.digitalocean.com/community/tutorials/how-to-protect-your-server-against-the-shellshock-bash-vulnerability Shellshock server bash vulnerability], make sure your server runs the latest version of bash.
 +
*This example and code still have to be tested (I will soon).
 +
*Source: [http://www.ilsistemista.net/index.php/linux-a-unix/45-joomla-3-3-centos-6-and-php-version-putting-all-together.html?start=1 This] HowTo for CENTOS6
   −
Placeholder.
      
==Other articles in this category==
 
==Other articles in this category==

Navigation menu