How to Install LAMP with PHP v5.5.0 and MySQL v5.5.32

Saturday, July 20th 2013. | how to

#howto ,#tutorial #VPS – How to Install LAMP with PHP v5.5.0 and MySQL v5.5.32 – This tutorial explains step by step guide (with pics) about How to Install LAMP with PHP v5.5.0 and MySQL v5.5.32

How to setup and configure a CentOS LAMP server with PHP5 (v5.5.0) and MySQL v5.5.32 – I posted all basic and necessary tutorials to guide you how to properly setup a working server to host your website either using LAMP or LEMP/LNMP stack on CentOS. In this article, you’ll see similar guide but this time we’ll try to use latest version of PHP and MySQL within the LAMP stack. As usual, I use CentOS 6.4 x86_64 hosted by DigitalOcean but however the steps should be also similar if you are using any version of CentOS 6.

About PHP 5.5.0

PHP 5.5.x is the latest version currently (at the time I posted this article). There are a few incompatibilities and new features that should be considered. Its developers suggest users to firstly test their code before switching PHP versions in production environments. One thing that’s so good in PHP5.5.x is the new built-in Zend OPCache engine, that means you won’t have to use external opcode caches any more, it all comes out of the box. OPcache improves PHP performance by storing precompiled script “byte code” in shared memory, thereby removing the need for PHP to load and parse scripts on each request. Just similar to Varnish but different way it works.

Prerequisites

  1. I assumed you already have either a VPS or Dedicated server running CentOS and you have access to it. In this tutorial I use CentOS 6.4.
  2. I also assumed you knew already how to use Putty or Terminal to SSH-ing a server.
  3. I believe you knew –at least part of– most common Unix commands used to manage an unmanaged server.

How to Install Apache and PHP 5.5.0

Step 1 – Login to your server and follow my previous guide about Basic setup for CentOS before you build a live web server. You may and may not follow that tutorial but if you followed, it will give you some basic security tweak to your server.

Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch login as root. You may also need to type this command to go to the root directory:

cd ~

switch-root-login

Step 2 – First thing first, we have to add additional repository, the one from Remi and Epel. The command for that:

for CentOS 6 x86_64:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

for CentOS 6 32-bit:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

screenshot:

adding-repo

Step 3 – Finally, use this one line of command to install Apache 2, PHP 5.5 and MySQL 5.5.32:

yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common

screenshot:

install apache php5 mysql 5.5.32

Hit Y to confirm.

Step 4 – Additionally, you may also need to install several most common PHP modules (your app / script may need this):

yum --enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo -y

screenshot:

install php modules

ps: You can see the list of all available PHP modules using this command:

yum search php-

Step 5 – Now you can start Apache service for the very first time;

# Start Apache
service httpd start

# Start Apache (alternate command)
/etc/init.d/httpd start

# Stop Apache
service httpd stop

# Stop Apache (alternate command)
/etc/init.d/httpd stop

# Restart Apache
service httpd restart

# Restart Apache (alternate command)
/etc/init.d/httpd restart

Step 6 – Also start MySQL database server for the very first time:

# Start MySQL
service mysqld start

# Start MySQL(alternate command)
/etc/init.d/mysqld start

# Stop MySQL
service mysqld stop

# Stop MySQL(alternate command)
/etc/init.d/mysqld stop

# Restart MySQL
service mysqld restart

# Restart MySQL (alternate command)
/etc/init.d/mysqld restart

Step 7 – Optionally, you can add Apache and MySQL service to system startup link so it will starts each time your server boot:

chkconfig --levels 235 httpd on
chkconfig --levels 235 mysqld on

That’s it. What’s next? Obviously you can start adding your new website in your server. Read my previous guide about how to add new Apache virtual host for new website. Do not also forget to catch up all CentOS tutorial. Good day..

This post How to Install LAMP with PHP v5.5.0 and MySQL v5.5.32 is part of ServerMom.

Source link