Install and configure lamp v2 in Linux

Source: Internet
Author: User
Tags vars

Copyright statement: original works can be reproduced. During reprinting, be sure to mark them as hyperlinks.ArticleOriginal publication, author information, and this statement. Otherwise, legal liability will be held. Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan

Only MySQL + Apache + PHP is installed.

The system comes with zlib libxml2 libxslt libcurl OpenSSL

The modified Linux installation and configuration of lamp v2 are as follows:

This is really abnormal. n software needs make.

I suddenly began to like xmapp here.

I hope the majority of phper will have time to study this too much time... if you are a professional Linux administrator... you have to work hard .!

The first installation is stuck on zlib... the final result is to delete the centos that is almost corrupted...

The painful process is as follows:

MySQL + Apache + OpenSSL + PHP + Gd + libpng + libjpeg + FreeType2 + zlib (this is very important to use.) + libxml2

MySQL

This is the first hurdle

First make error... after analysis, we know that GCC is not installed. dizzy. when installing centos, you do not need to select a development tool... after make can be used... failed to make after analysis .... I know that glibcc is under it. It is compiled... inverted ~~~~

Directly copy the past...

Apache is not installed first. Some other small things must be installed first. However, these small things lead to the termination of the entire process.

Zlib

This is the first installation. Nothing to say,./configure -- prefix =/usr/myz/libs/zlib

Smooth Installation

FreeType2

Also installed smoothly

Then libpng

It's stuck here...

Prompt that zlib cannot be found

I tried to change the makefile... the result is useless...

Then I re-installed zlib... and installed libpng.... The result was not loaded to the specified location... crazy.

Delete later

Pain... if God gives me another chance... I am willing to directly install xmapp... if you need to install a Web server. I select. rpm... if it is Ubuntu, I will choose apt-Get...

Try again as follows:

MySQL + Apache + PHP + Gd + libpng + libjpeg + FreeType2 + zlib + libxml

MySQL

Tar-zxvf mysql.tar.gz

Groupadd MySQL

Useradd-G MySQL

To the decompressed directory

Initialize the database:./scripts/mysql_install_db -- user = MySQL

Chown-r root.
Chown-r Mysql Data
Chgrp-r MySQL.

Add to System Startup Group (Red Hat): CP./support-files/MySQL. Server/etc/init. d/mysqld

Chkconfig mysqld Reset
Add CP./support-files/my-medium.cnf/etc/My. CNF
Bin/mysqld_safe -- user = MySQL &

Here there is a small problem, and an error occurs during system startup. because MySQL cannot be found, you must modify/etc. init. d/mysqld: Change/usr/local/MySQL to my directory. OK

Another point is to go to Ln-fs/usr/myz/MySQL/bin/MySQL under/usr/local/bin.

Of course, mysqladmin mysqldump

In this way, you cannot remotely connect... dizzy ....

Grant all on *. *Root @ "202.11.10.253"Identified by" dbpassword"

OK... MySQL is installed...

MySQL Configuration

The settings are actually just done.

Mysqladmin-u Root Password xxx

Now, only the character set is set.

Find the client configuration [client] and add it below

Default-character-set = utf8 default Character Set: utf8

Add in [mysqld]

Default-character-set = utf8 default Character Set: utf8

Init_connect = 'set names utf8' (utf8 encoding is used to set the connection to the MySQL database to run utf8)

After modification, restart MySQL (/etc/init. d/MySQL restart) and query show variables like 'character % ';

Zlib

This is very important... learn from the previous lessons and install it by default.

# Tar-zxvf zlib-1.2.2.tar.gz
# Cd zlib-1.2.2
#./Configure
# Make
# Make install

Libjpeg

This is a dumb. You cannot create a folder by yourself. If you try it, you will know. In the make install step

#./Configure -- prefix =/usr/local/JPEG -- enable-shared -- enable-static

# Make
# Make install

Create a folder. OK

Libpng

# Cp scripts/makefile. Linux makefile
# Make (if you are prompted that the zlib library file or header file cannot be found, the default path of zlib in the makefile file is incorrect. You can edit the MAKEFILE file, find the zlib item, and re-specify the path to zlib.By default ).
# Make install

FreeType

./Configure -- prefix =/usr/local/FreeType

Make

Make install

Libxml2
./Configure -- prefix =/usr/local/libxml2
Make
Make install

CP xml2-config/usr/bin this will be used during PHP Compilation

GD

Note: Both PNG and zlib are installed by default.

#. /Configure -- prefix =/usr/local/GD2 -- With-JPEG =/usr/local/JPEG -- With-PNG =/usr/local/lib -- With-zlib =/usr /local/lib -- With-FreeType =/usr/local/FreeType
# Make
# Make install

If the NO of the above items does not appear, the installation is successful .....Next, Apache is used.

Apache

#. /Configure -- prefix =/usr/myz/Apache -- sysconfdir =/etc -- enable-so -- enable-track-vars -- enable-Rewrite -- With-z =/usr/local/ lib
# Make
# Make install

Sysconfdir is the configuration file directory

So is to allow so

Track-vars enables Cookie get/post and other tracing functions

Rewrite rewrite

Z zlib Compression

Apache configuration

VI/etc/httpd. conf
You need to modify the following items:
Find loadmodule php5_module modules/libphp5.so
Load PhP5 on Apache using dynamic modules (DSO. Apache loads PHP after it is started.
Remove the # sign (note removed by default) (loadmodule XXX. So will automatically come out after PHP is installed)
# Addtype application/X-gzip. GZ. tgz
Add two rows below
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs
The first sentence is to let Apache call the PHP module to explainCode. The second sentence is to highlight PHP in syntax when the. PHPs file suffix is encountered.Source code. Many articles can be made here, such as addtype application/X-httpd-PHP .html. In this example, apachewill Use PHP to explain the. html file. The "pseudo static" of many websites is what we do here.
Find directoryindex index.html
Change to directoryindex index.html index.htm index. php. This is to set the default homepage for Apache. And there is a sequential order.

Modify WWW directory

First mkdir/var/WWW

Then modify the httpd. conf file.

DocumentRoot "/var/www"

<Directory "/var/www">
# Cp/usr/lamp/apache2/bin/apachectl/etc/init. d/httpd
Set auto-start
# Chkconfig -- add httpd

An error occurs. Add the following content to the first line of httpd:

# Myz

# Chkconfig: 2345 60 40

# Description: myz Server
Add Apache as a system service
# Service httpd start

Please wait, because libphp5.so will be available only after PHP is installed.

Permission denied Error

The process is as follows:

1. VI/etc/sysconfig/SELinux

Change SELinux = disabled

2. chcon-T texrel_shlib_t/usr/Apache/modules/libphp5.so

Or simply turn off SELinux, # setup finds SELinux-related disabled in it.
Then start will start the service. Similarly, service httpd stop is to stop the service. You can also use service httpd restart. However, there is no prompt information. You can write a shell script by yourself. It looks much better to add some prompt information.

Here, an error occurs during startup:

Httpd cocould not reliably determine

Add the following content to servername: www.example.com: 80 in httpd. conf:

Www.yourdomain.com: 80

By the way, if you cannot Ping port 80, try to turn off the Linux firewall. # There is one in setup.

PHP

#./Configure -- prefix =/usr/myz/PHP \

-- With-apxs2 =/usr/myz/Apache/bin/apxs \

-- With-config-file-Path =/etc \

-- Enable-safe-mode \

-- With-zlib = \

-- With-zlib-Dir =/usr/local/Lib \

-- With-libxml-Dir =/usr/local/Lib \

-- Enable-mbstring \

-- With-mysql =/usr/myz/MySQL \

-- With-mysql-Sock =/tmp \

-- With-PDO-mysql =/usr/myz/MySQL \

-- Enable-soap \

-- With-XMLRPC \

-- Enable-sockets \

-- With-curl =/usr/local/Lib \

-- With-XSL =/usr/local/Lib \

-- With-OpenSSL =/usr \

-- With-Gd =/usr/local/Lib \

-- With-JPEG-Dir =/usr/local/Lib \

-- With-PNG-Dir =/usr/local/Lib \

-- With-FreeType-Dir =/usr/loca/Lib \

Blue is what I think is necessary.

Some are installed. For example, Apache, zlib, libxml2, libcurl, and libxslt.

I use 5.2.5. Some of the items are default enable, such as CLI.

This is not all... it's enough... but it's not good... it's too much.

I edited it n times !!!!

Not enough in the United States. libcurl and XSLT Are Not Installed

Make

The most terrible thing is to keep loop during make test... never let it go. You can only reset the computer...

Make install

Another error occurred, saying that libphp5.so could not be found. After searching for half a day, I deleted all the items and re-checked them. OK.

Copy PHP. ini-recommended to PhP. ini and put it in the/etc/directory.

PHP configuration

This... Whatever it is... because it is an experiment, so nothing has been changed... just read the phpinfo ()

End...

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.