Over a million developers have joined DZone.
Platinum Partner

CentOS 6.4 and PHP 5.3

· Web Dev Zone

The Web Dev Zone is brought to you in partnership with Mendix.  Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.

In the first article, I described how I set up CentOS 6.4 including with Apache to get ready for web development. In this article, I’ll describe what I did to get CentOS and PHP 5.3 up and running.

First, you’ve read the first article right?

The next thing we’ll do is add PHP 5.3 into the mix.

It seems that most of what we need is available is available from here:

CentOS installing PHP

Do a search for PHP, and you’ll find plenty of PHP 5.3 options to choose from. Here are the main components I installed:

CentOS PHP 5.3

I also added these:

CentOS PHP 5.3

And finally, we’ll add Xdebug:

CentOS xdebug php 5.3

Then it’s just a question of clicking “Apply” and letting CentOS sort out the dependencies for you.

Next, open up Terminal, and restart Apache:

sudo service httpd restart

Then, you can create a PHP file in your public_html folder called info.php. Add this code:

Save it, and then we can try it out in the browser:

CentOS PHP Info

PHP 5.3 Short Tags

I use CodeIgniter quite a lot. And in views I like to use the short tag: . It’s switched off by default though, but we can fix that.

Drop back into Terminal and do:

sudo gedit /etc/php.ini

Then, on around line 229 change it from Off to On. Save and close the file, then restart Apache: sudo service httpd restart.

Add a Repository

You’ll need to add a repository to make stuff like phpMyAdmin available in Add/Remove software. The link to the repository can be found here.

To add it, drop back into Terminal an do:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


You’ll find this available in “Add/Remove Software” too. Again, CentOS will resolve the dependencies for you.

MySQL is already installed, so drop back into Terminal, and start the server:

sudo service mysqld start

You’ll be prompted to change the root password, which you should:

usr/bin/mysqladmin -u root password 'new-password'

Then you can access phpMyAdmin at: http://localhost/phpmyadmin.


We’ve installed PHP and supporting libraries, we’ve added phpMyAdmin, and changed the MySQL root password. Next, we’ll get Ruby and Rails installed.

The Web Dev Zone is brought to you in partnership with Mendix.  Learn more about The Essentials of Digital Innovation and how it needs to be at the heart of every organization.


Published at DZone with permission of Andy Hawthorne , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}