Contents
- PHP versions supported
- Help if you鈥檙e just starting out
- Verify PHP is installed
- PHP 5.6 on CentOS
- PHP 5.5 on CentOS
- Set PHP configuration options
If you must install both Apache and PHP, install Apache first.
PHP versions supported
Magento requires:
- PHP 5.5.x
- PHP 5.6.x
Magento no longer supports PHP 5.4.
Help if you're just starting out
If you鈥檙e new to all this and need some help getting started, we suggest the following:
- Is the Magento software installed already?
- What is the software that the Magento server needs to run?
- What operating system is my server running?
- How do I log in to my Magento server using a terminal, command prompt, or SSH?
Verify PHP is installed
To verify if PHP is installed already, enter php -v
. If PHP is installed, messages similar to the following display:
PHP 5.6.4 (cli) (built: Dec 20 2014 17:30:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
The preceding message confirms that the Zend OPcache
is installed. We strongly recommend using the OPcache for performance reasons. If your PHP distribution does not come with the OPcache, see the PHP OPcache documentation.
If PHP is installed, continue with the next prerequisite, MySQL.
If PHP is not installed, see one of the following sections:
PHP 5.6 on CentOS
There is more than one way to upgrade CentOS 6.5 to PHP 5.6; the following is a suggestion only. Consult a reference for additional options.
To upgrade to PHP 5.6:
-
Enter the following commands in the order shown:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-bcmath
The
bcmath
extension is required for Magento Enterprise Edition (EE) only. -
Restart Apache:
service httpd restart
-
Enter the following command to verify that PHP 5.6 is installed:
php -v
The following response indicates that PHP 5.6 is installed properly:
PHP 5.6.4 (cli) (built: Dec 20 2014 17:30:46) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
The preceding message confirms that the Zend OPcache
is installed. We strongly recommend using the OPcache for performance reasons. If your PHP distribution does not come with the OPcache, see the PHP OPcache documentation.
PHP 5.5 on CentOS
There is more than one way to upgrade CentOS 6.5 to PHP 5.5; the following is a suggestion only. Consult a reference for additional options.
To upgrade to PHP 5.5:
-
Enter the following commands in the order shown.
yum -y update rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm yum -y remove php-common-5.3.3-40.el6_6.x86_64 yum -y install php55w php55w-opcache yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-intl php55w-mbstring php55w-bcmath yum -y update
The
bcmath
extension is required for Magento Enterprise Edition (EE) only. -
Restart Apache:
service httpd restart
-
Continue with the next section.
Set PHP configuration options
This section discusses how to:
- Set the system time zone for PHP; otherwise, errors like the following display during the installation and time-related operations like cron might not work:
PHP Warning: date(): It is not safe to rely on the system's timezone settings. [more messages follow]
- Increase the PHP memory limit to at least 768MB for normal operation or 2GB for testing.
- Set
always_populate_raw_post_data = -1
always_populate_raw_post_data is deprecated in PHP 5.6. This setting causes PHP to always populate$HTTP_RAW_POST_DATA
with raw POST data. Failure to set this properly in PHP 5.6 results in errors when connecting to the database. - Disable asp_tags. If asp_tags are enabled, errors display when accessing PHTML templates.
asp_tags
will be removed in PHP 7.
To set PHP options:
- Locate
php.ini
by entering the following command:
php -i | grep "Loaded Configuration File"
Typical locations follow:
Ubuntu:/etc/php5/cli/php.ini
CentOS:/etc/php.ini
- Open
php.ini
in a text editor. - Locate your server's time zone in the available time zone settings.
- Locate the following setting and uncomment it if necessary:
date.timezone =
- Add the time zone setting you found in step 1.
- Change
memory_limit
to:
memory_limit = 768M
or more for normal operation
memory_limit = 2G
or more for testing - Required for PHP 5.6, recommended for PHP 5.5. Locate
always_populate_raw_post_data
, uncomment it if necessary, and set it as follows:
always_populate_raw_post_data = -1
- Locate the following setting:
asp_tags =
- Make sure its value is set to
Off
- Save your changes and exit the text editor.
- Restart Apache:
Ubuntu:service apache2 restart
CentOS:service httpd restart
Optional: Configure caching alternatives
You can optionally specify alternatives to file system caching in php.ini
by modifying the value of session.save_handler
. Magento supports the following values:
files
(the default) for file system cachingdb
for database cachingredis
for Redis caching- Any other custom cache type you set up; however, it's up to you to know how to specify it in
php.ini
Find us on