Lamp is
LInux,
APache,
MYsql,
PHP's abbreviation. This tutorial will teach you how to install Apache2web server +php (mod_php) +mysql on a Fedora 12 server.
I have tested it correctly and you can use it safely.
1. Foreword
In this tutorial, I use the host name Server1.example.com,ip address is 192.168.0.100. These settings may be different from what you want, so you have to change them in the right place.
2 installation MySQL5
Install MySQL with the following commands:
Yum install MySQL Mysql-server
We then create a system-initiated link for MySQL (so that MySQL will start with the system startup) 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 Installation Apache2
Fedora has Apache2 this package by default, and we can install it with the following commands:
Yum Install httpd
Now configure the system so that Apache can start with the system boot ...
Chkconfig--levels 235 httpd on
... Start Apache:
/ETC/INIT.D/HTTPD start
Now open the browser and access http://192.168.0.100, you should be able to see the reserved page of the Apache2:
The default document path for Apache in Fedora is/var/www/html, and the configuration file is/etc/httpd/conf/httpd.conf. The rest of the configuration files are stored in/etc/httpd/conf.d/.
4
Install PHP5
We use the following command to install the PHP5 and Apache PHP5 modules:
Yum Install PHP
And then we start the next Apache:
/ETC/INIT.D/HTTPD restart
5
test php5/Get details of PHP5 after installation
The default document path for a Web site is/var/www/html. We now create a small PHP (info.php) file in this folder and access it in the browser. This file will display a lot of details about the PHP installation, such as the PHP version.
vi/var/www/html/info.php
<?php
Phpinfo ();
?>
Now we access this file in the browser (for example, http://192.168.0.100/info.php):
As you can see, PHP5 is working, and Apache, shown in the Server API line, works in Apache2.0 handler mode. If you page down, you will see all the modules that have PHP5 installed. MySQL is not listed here, it means that the current PHP5 does not support MySQL.
6 Let PHP5 support MySQL
We install Php-mysql This package can make MySQL support PHP. It's also a good idea to install additional PHP5 modules that you might use in other applications. You can use the following stars to search the PHP5 module first:
Yum Search PHP
Select the modules you want and install them using the following commands:
Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-ma Gpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy
Now reboot Apache2:
/ETC/INIT.D/HTTPD restart
Now refresh in the browser http://192.168.0.100/info.php, and turn to the module section again. You should be able to find a lot of new modules here, including the MySQL module:
7 phpMyAdmin
phpMyAdminis a web to manage the MySQL database tool:
You can install phpMyAdmin using the following commands:
Yum Install phpMyAdmin
Now we configure phpMyAdmin. We change the Apache profile so that it can only be accessed locally (by unregistering the <directory/usr/share/phpmyadmin/parameters):
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 than localhost
# Dangerous unless properly secured by SSL
Alias/phpmyadmin/usr/share/phpmyadmin
Alias/phpmyadmin/usr/share/phpmyadmin
#
# Order Deny,allow
# Deny from all
# Allow from 127.0.0.1
# Allow from:: 1
#
# This directory does not require access over Http-taken from the original
# phpMyAdmin Upstream Tarball
#
Order Deny,allow
Deny from all
Allow from None
# This configuration prevents mod_security in phpMyAdmin directories from
# filtering SQL etc. This could break your mod_security implementation.
#
#
#
# secruleinheritance off
#
#
Restart Apache:
/ETC/INIT.D/HTTPD restart
Then you can go through the http://192.168.0.100/phpmyadmin/: Access to phpMyAdmin:
8 RELATED LINKS
- Apache: http://httpd.apache.org/
- PHP: http://www.php.net/
- MySQL: http://www.mysql.com/
- Fedora: http://fedoraproject.org/
- phpMyAdmin: http://www.phpmyadmin.net/
9 Related statements
Source Address: Http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-fedora-12-lamp