Lamp environment setup tutorial-Linux as4 + httpd-2.2.6 + mysql-5.0.27 + php-5.2.6

Source: Internet
Author: User
Tags mcrypt

Platform is: Linux as4 + httpd-2.2.6 + mysql-5.0.27 + php-5.2.6

Components are: phpmyadmin-3.1.3 + ZendOptimizer-3.2.8

1. Install MySQL

Tar zxvf mysql-5.0.27.tar.gz
Go to the MySQL decompressed source code file directory
./Configure -- prefix =/usr/local/MySQL # Set the installation path of MySQL
./Configure -- With-charset = GBK -- With-collation = gbk_chinese_ci -- With-extra-charsets = none # Add the GBK character set
Make & make install # compile and install.
Configure MYSQL:
Groupadd MySQL # Add a MySQL Group
Useradd-G MySQL # Add a MySQL user and add it to the MySQL Group
CD/usr/local/MySQL/# Switch to the CD/usr/local/MySQL/directory
Chown-r mysql. # change the owner of the current directory to a MySQL user
Chgrp-r mysql. # change the MySQL user files in the current directory to the MySQL Group
CD/usr/local/src/mysql-5.0.27/support-files # under support-files in the source MySQL directory
CP my-medium.cnf/etc/My. CNF # copy file to/etc/overwrite my. CNF File
CD/usr/local/MySQL/bin # change the directory to/usr/local/MySQL/bin
./Mysql_install_db -- user = MySQL # initialize the database as MySQL
CD/usr/local/MySQL # change the directory to/usr/local/MySQL
Chown-r MYSQL: MySQL var # change the MySQL user of the VaR directory to the MySQL Group
Chmod 755 var # change the VaR directory permission
CD/usr/local/MySQL/bin # change the directory to/usr/local/MySQL/bin
./Mysqld_safe -- user = MySQL & # generate a socket with the MySQL User Startup Library
Netstat-ant | grep 3306 # Check whether MySQL is started. MySQL uses port 3306.
CD/usr/local/src/mysql-5.0.27/support-files/# Change directory
CP mysql. Server/etc/init. d/mysqld # copy the file for Automatic startup upon startup
Chmod 755/etc/init. d/mysqld # Grant mysqld Permissions
Chkconfig -- add mysqld # Add the mysqld service to the System
Chkconfig mysqld on # Open the myslqd Service
Service mysqld restart # Start the MySQL Service
Test MYSQL:
CD/usr/local/MySQL/bin # change the directory to CD/usr/local/MySQL/bin
MySQL # log on to MySQL
Show databases; # view database tables

2. install Apache
# Tar xvzf httpd-2.2.6.tar.gz
# Cd httpd-2.2.6
#./Configure -- enable-Dav -- enable-so -- enable-mod-shared = all -- enable-module = rewrite -- prefix =/usr/local/apache2
# Make & make install

# Ln-S/usr/local/apache2/bin/apachectl/sbin/apachectl
Edit the configuration file httpd. conf.
# Vi/usr/local/apache2/CONF/httpd. conf
Modification content:
Servername www.example.com: 80 is
Servername localhost: 80 or the IP address of the Apache server
After installation and modification, start the Apache process:/usr/local/apache2/bin/apachectl start (or under/usr/local/apache2/bin,

Use./httpd-K start), then open the browser http: // localhost/, if there is a test page "It works! "The installation is successful.

3. install PHP

tar zxvf php-5.2.1.tar.gz
enter the directory of source code files decompressed by php
. /configure -- prefix =/usr/local/PHP -- enable-track-vars -- enable-mbstring = all -- With-mcrypt -- With-mysql =/usr/local/MySQL -- with-apxs2 =/usr/local/apache2/bin/apxs
make & make install # compile,.
cp php. ini-Dist/usr/local/PHP/lib/PHP. INI
modify the configuration file in apache2
VI/usr/local/apache2/CONF/httpd. conf
Find "# addtype application/X-gzip. GZ. tgz "
and add
addtype application/X-compress. z
addtype application/X-gzip. GZ. tgz
addtype application/X-httpd-PHP. php
addtype application/X-httpd-PHP-source. PHPs
these two lines aim to enable Apache to recognize PHP.
Find "directoryindex index.html".
Add index. PHP asked it to set index. php as the Environment page
test environment:
Cd/usr/local/httpd/htdocs/
# vi/usr/local/httpd/htdocs/index. php
input:
phpinfo ();
?>
#/usr/local/apache2/bin/apachectl restart Apache server
for example, enter http://192.168.xxx.xxx/index.php in the browser to test restart. If it succeeds, you will be prompted to save the file content.

4. phpMyAdmin Installation
Tar zxvf phpMyAdmin-3.1.3-all-languages.tar.gz

Music phpMyAdmin-3.1.3-all-languages/usr/local/phpMyAdmin

Add

<Virtualhost *: 80>
DocumentRoot "/usr/local/phpMyAdmin"
Servername mysql.tll163.com
</Virtualhost>

Before that, open the directory permission for/usr/local in httpd. conf.

Note: Install phpMyAdmin before running it.

Php-mcrypt
Php-mhash
Libmcrypt
Libmcrypt-devel
Libmhash
Libmhash-devel

The above RPM packages can be downloaded at ftp://rpmfind.net/linux/epel/4/ I #/

If you haven't compiled PHP to support mcrypt before, the following prompt appears: "unable to load MySQL extension, <br/> check PHP configuration, no PHP extension settings found ".

Then you need to re-compile and install PHP and bring -- With-mcrypt and release extension = php_mcrypt.dll in the PHP. ini configuration file (remove the previous one ;)

Make sure to restart Apache after all the modifications are complete.

Go to the phpMyAdmin directory and copy config. sample. ini. php to config. ini. php.

Then perform the extension settings:

1. Search for the string "$ cfg ['blowfish _ secret']". This variable sets the cookie encryption key. You can simply enter a few characters;
Eg: $ cfg ['blowfish _ secret'] = 'sqe service MySQL admin ';
2. Search for the string "$ cfg ['servers'] [$ I] ['auth _ type']". The default value is "Config", which is generally used for local debugging, security risks exist. We recommend that you set the value to "cookie"
Eg: $ cfg ['servers'] [$ I] ['auth _ type'] = 'cooker ';

Finally, save the file and exit. phpMyAdmin has been installed and configured.

Enter mysql.tll163.com, enter the MySQL account password, and enter PMA for operation.

5. Install zendoptimizer

Tar zxvf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz

Go to ZendOptimizer-3.2.8-linux-glibc21-i386 directory

./Install

Step by step as prompted

The key is not to find the error.

PHP. ini and apachectl Directories

My directories are

/Usr/local/PHP/lib/PHP. ini

/Usr/local/apache2/bin/apachectl

 

Related Article

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.