Line 1: |
Line 1: |
| {{WIP box}} | | {{WIP box}} |
| | | |
− | Placeholder.
| + | ===== 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 |
| + | |
| | | |
| ==Other articles in this category== | | ==Other articles in this category== |