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.
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.
I also assumed you knew already how to use Putty or Terminal to SSH-ing a server.
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:
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:
Step 3 – Finally, use this one line of command to install Apache 2, PHP 5.5 and MySQL 5.5.32:
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):
install php modules
ps: You can see the list of all available PHP modules using this command:
Step 5 – Now you can start Apache service for the very first time;
Step 6 – Also start MySQL database server for the very first time:
Step 7 – Optionally, you can add Apache and MySQL service to system startup link so it will starts each time your server boot:
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..
How to Build LAMP Server on CentOS 6.4
How to Install PHPMyAdmin on CentOS LAMP Server
Basic Guide: Install MySQL Server On CentOS
How To Build Working CentOS Server with Apache and PHP
How To Build Working CentOS Server with LightTPD and PHP5 (Part 2)