There is a new version of this tutorial available for Fedora 21.

Installing Apache2 With PHP5 And MySQL Support On Fedora 17 (LAMP) - Page 2

5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www/html. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/html/info.php


Now we call that file in a browser (e.g.

As you see, PHP5 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.


6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

yum search php

Pick the ones you need and install them like this:

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy

APC is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It's similar to other PHP opcode cachers, such as eAccelerator and Xcache. It is strongly recommended to have one of these installed to speed up your PHP page.

APC can be installed as follows:

yum install php-pecl-apc

Now restart Apache2:

systemctl restart httpd.service

Now reload in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:


7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases.

phpMyAdmin can be installed as follows:

yum install phpmyadmin

Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory /usr/share/phpMyAdmin/> stanza):

vi /etc/httpd/conf.d/phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php
# Allows only localhost by default
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

#<Directory /usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     <RequireAny>
#       Require ip
#       Require ip ::1
#     </RequireAny>
#   </IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from
#     Allow from ::1
#   </IfModule>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
       Require ip
       Require ip ::1
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from
     Allow from ::1

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>

Restart Apache:

systemctl restart httpd.service

Afterwards, you can access phpMyAdmin under


Falko Timme

About Falko Timme

Falko Timme is an experienced Linux administrator and founder of Timme Hosting, a leading nginx business hosting company in Germany. He is one of the most active authors on HowtoForge since 2005 and one of the core developers of ISPConfig since 2000. He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

Suggested articles

8 Comment(s)

Add comment


By: Anonymous

Thank you for the excellent lamp tutorial.

It was easy to follow and everything worked.

By: AgR

Good explication :D :D :D


By: Chris Thain

Great article, thank you! I followed the instructions and everything worked very well indeed. A few tweaks to the configuration files and I was off to the races.

I will add one comment for anyone who may encounter the same problem I did: I use mysqli_result::fetch_all() in one of my applications and after installing PHP and MySQL following these instructions my application stopped working. I got the following error:

Fatal error: Call to undefined method mysqli_result::fetch_all()

The reason is that mysqli_result::fetch_all() is only available for the MySQL Native Driver so if you want/need to use mysqli_result::fetch_all() then you must install php-mysqlnd ( yum install php-mysqlnd ) rather than php-mysql.

By: George

Great job on this tutorial. It worked perfectly for me from the first command. Now I am at the phpmyadmin and can continue on my work. Really nice job!

The only small request is to add additional information about perl and python configuration also on Fedora. I think in lamp p sometimes stands for those other languages and you may have an even more complete tutorial by adding those.

Thanks again.

By: Gautam

Awesome tutorial, i didn;t get stuck even once! Great job and thanks a ton!

By: Jamal

Thank you.

every thing worked well!!!

By: Bryan Wolfford

At the very end of this tutorial, when you load .../phpmyadmin/ you will be prompted for a username and password. If you followed this tutorial verbatim, this is the mysql user 'root' (not the linux root)  and the password that you set up earlier in the process.


By: Anonymous

Thanks man.....perfect!