Difference between revisions of "PHP via RPM"
From OpenLiteSpeed Wiki
Marmstrong (talk | contribs) |
Marmstrong (talk | contribs) (→Installing Multiple PHP Versions) |
||
Line 59: | Line 59: | ||
The LiteSpeed Repository automatically installs PHP to <code>/usr/local/lsws/lsphp5x/bin/lsphp</code> where <code>5x</code> is the version and subversion. Thus PHP 5.5 would be installed to <code>/usr/local/lsws/lsphp55/bin/lsphp</code>. | The LiteSpeed Repository automatically installs PHP to <code>/usr/local/lsws/lsphp5x/bin/lsphp</code> where <code>5x</code> is the version and subversion. Thus PHP 5.5 would be installed to <code>/usr/local/lsws/lsphp55/bin/lsphp</code>. | ||
− | This allows you to easily install multiple versions of PHP because different versions of PHP are installed to different directories. | + | This allows you to easily install multiple versions of PHP because different versions of PHP are installed to different directories. See our [[Help:Multiple_PHPs|guide to setting up multiple PHPs]] for further details. |
=== Direct LSWS to the Location of the Installed PHP === | === Direct LSWS to the Location of the Installed PHP === |
Revision as of 19:51, 25 November 2014
Installing PHP with LiteSpeed SAPI from a repository is much faster than compiling it yourself. Some users also may be unused to compiling PHP and will find this method more comfortable. PHP for LiteSpeed (LSAPI) is available in two repositories — Remi Repository and our own LiteSpeed Repository. Choose the repository that best fits your needs.
Contents
LiteSpeed Repository
- PHP 5.3, 5.4, 5.5, and 5.6.
- CentOS and RHEL 5/6/7.
- Contains most up-to-date versions of LSAPI. (Do not have to wait for a new PHP version to be released.)
- Easily install multiple versions of PHP (by default installed to different locations).
- Contains all frequently used PHP packages.
- Contains multiple possible MySQL support packages (via native driver or client library).
- Contains multiple opcode caching options: APC, Xcache, Zend Opcache.
Installing PHP from the LiteSpeed Repository
Add EPEL Repository
yum install epel-release
Add LiteSpeed Repository
We currently maintain repositories for CentOS 5, 6, and 7. You can add our repository with the following commands:
CentOS 5:
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el5.noarch.rpm
CentOS 6:
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
CentOS 7:
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
Install a PHP Build
Once you've added our repository, you can use yum to install PHP for LiteSpeed with a variety of modules. The following command will install LSPHP 5.5:
yum install lsphp55
Listing multiple packages will install PHP with multiple modules.
Full list of available packages
Full list of all available packages
Useful PHP Install Commands
Install PHP 5.5 with all non-conflicting modules:
yum install lsphp55-* --skip-broken
Install all available versions of PHP (5.3, 5.4, 5.5, and 5.6) with all non-conflicting modules:
yum install lsphp5*-* --skip-broken
Installing Multiple PHP Versions
The LiteSpeed Repository automatically installs PHP to /usr/local/lsws/lsphp5x/bin/lsphp
where 5x
is the version and subversion. Thus PHP 5.5 would be installed to /usr/local/lsws/lsphp55/bin/lsphp
.
This allows you to easily install multiple versions of PHP because different versions of PHP are installed to different directories. See our guide to setting up multiple PHPs for further details.
Direct LSWS to the Location of the Installed PHP
As noted above, the LiteSpeed Repository installs PHP to /usr/local/lsws/lsphp5x/bin/lsphp
. This is not the place LSWS normally looks for PHP, so we will now need to direct LSWS to look there.
The easiest way to do this is from the command line:
ln -sf /usr/local/lsws/lsphp55/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
You can also go to the WebAdmin console > External App > your external application > Command. Change the Command setting to match the location PHP was installed to (for example, /usr/local/lsws/lsphp54/bin/lsphp
for PHP 5.4).
Click Save and then perform a Graceful Restart for the changes to take effect.
Check your PHP installation
You can check that your PHP installation is correct by viewing a phpinfo() page. The phpinfo() page should show the correct version of PHP and LiteSpeed as the server API.
Les RPM de Remi (Remi Repository)
- PHP 5.4, 5.5, and 5.6.
- CentOS and RHEL 5/6/7 and Fedora 17-21.
- Allows installation of multiple builds of PHP through SCL.
- Contains packages for many rare use cases as well as more common use cases.
Installing PHP from Remi Repo
The following steps can be used to install PHP 5.5 with LSAPI on CentOS 6. Consult the [Repository] site for installation with other builds.
Add the repositories
Remi Repository requires the EPEL repository as well.
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Enable Remi Repo
Open the Remi repo file:
vi /etc/yum.repos.d/remi.repo
In the [remi-php55]
section, set enabled
to 1
.
Note: The [remi-php55]
section is for PHP 5.5. The [remi-php]
section is for PHP 5.4 and the [remi-php56]
section is for PHP 5.6.
Install PHP for OpenLiteSpeed from the repository
Remi's PHP with LSAPI package is called "php-litespeed".
yum install php-litespeed
Note: You can, of course, also install any other packages you wish (such as php-opcode).
Direct OpenLiteSpeed to the Location of the Installed PHP
By default, Remi Repo installs PHP with LSAPI to /usr/bin/lsphp
. This is not the place OpenLiteSpeed normally looks for PHP, so we will now need to direct OpenLiteSpeed to look there.
The easiest way to do this is from the command line:
ln -sf /usr/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
You can also go to the WebAdmin console > External App > your external application > Command. Change the command setting to match the location PHP was installed to (/usr/bin/lsphp
).
Click Save and then perform a Graceful Restart for the changes to take effect.
Check your PHP installation
You can check that your PHP installation is correct by viewing a phpinfo() page. The phpinfo() page should show the correct version of PHP and LiteSpeed as the server API.