Install Apache2 + PHP5 + MySQL (LAMP) on Fedora 11)

Source: Internet
Author: User

LAMP is short for Linux, Apache, MySQL, and PHP. This tutorial will teach you how to install Apache2web SERVER + PHP (mod_php) + MySQL on a Fedora 11 server.

I have tested it correctly. You can use it with confidence.
1. Preface


In this tutorial, the host name I use is server1.example.com and the IP address is www.6688.cc. These settings may be different from what you want, so you must modify them as appropriate.
2 install MySQL5

Run the following command to install MySQL:

Yum install mysql-server

Then we create a system startup link for MySQL (in this way, MySQL will start as the system starts) and start the MySQL server:

Chkconfig-levels 235 mysqld on
/Etc/init. d/mysqld start

Run

Mysqladmin-u root password yourrootsqlpassword
Mysqladmin-h server1.example.com-u root password yourrootsqlpassword

To set a password for the root user (otherwise anyone can access your MySQL database !) 3. Install Apache2

Fedora has The Apache2 package by default. We can use the following command to install it:

Yum install httpd

Now, the system is configured to enable Apache to start with the system...

Chkconfig-levels 235 httpd on

 

... Start Apache:

/Etc/init. d/httpd start

Now open your browser and access the http://www.6688.cc, you should be able to see the reserved page of Apache2:

 

In Fedora, the default path of Apache is/var/www/html, and the configuration file is/etc/httpd/conf/httpd. conf. The remaining configuration files are stored in/etc/httpd/conf. d /. 4. Install PHP5

Run the following commands to install the PHP5 and Apache PHP5 modules:

Yum install php

Then we start Apache:

 

/Etc/init. d/httpd restart


5. Test PHP5/obtain the details of PHP5 after installation

The default document path for the website is/var/www/html. Create a small PHP (info. php) file in this folder and access it in the; browser. This file displays a large number of details about PHP installation, such as the PHP version.

Vi/var/www/html/info. php

<? Php

Phpinfo ();

?>

Now we access this file in a browser (such as a http://www.6688.cc/info.php ):

 


As you can see, PHP5 is working normally and Apache works in the Apache2.0 Handler mode displayed in the Server API line. If you flip down the page, you will see all the modules with PHP5 installed. MySQL is not listed here, which means PHP5 currently does not support MySQL. 6. Make PHP5 support MySQL

We installed the php-mysql package to enable MySQL to support php. It is better to install other PHP5 modules here, which may be used in other applications. You can use the following stars to search for the PHP5 module first:

Yum search php

Select the required modules and run the following command to install them:


Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php- mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy

Restart Apache2 now:

/Etc/init. d/httpd restart

Refresh http://www.6688.cc/info.php in the browser, and then go to zookeeper again. You should be able to find many new modules here, including the MySQL module: 7 phpMyAdmin

PhpMyAdmin is a web-based tool for MySQL database management:

Run the following command to install phpmyadmin:

Yum install phpmyadmin

Now we configure phpMyAdmin. We changed the Apache configuration file so that it can only be accessed locally (by logging out of the <Directory/usr/share/phpMyAdmin/parameter ):

 

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 shoshould be considered

# Dangerous unless properly secured by SSL

Alias/phpMyAdmin/usr/share/phpMyAdmin

Alias/phpmyadmin/usr/share/phpMyAdmin

# <Directory/usr/share/phpMyAdmin/>

# Order deny, allow

# Deny from all

# Allow from 127.0.0.1

# Allow from: 1

# </Directory>

# This directory does 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>

# 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>

# </IfModule>

Restart Apache:

/Etc/init. d/httpd restart

Then, you can use http://www.6688.cc/phpmyadmin/: phpmyadmin:


8 related links

Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: mysql.com/"> http://www.mysql.com/
Fedora: http://fedoraproject.org/
PhpMyAdmin: The http://www.phpmyadmin.net/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.