Experience in installing Apache + MySQL + PHP in RedHat5.4

Source: Internet
Author: User
& Nbsp; the Company's web server uses the RedHat5.4 system and adopts the php + mysql + apache structure. as the center supervisor, I am familiar with iis and apache in windows, and I am a newbie in redhat, it was not easy to spend a week in my spare time to show the true nature of the Ox. During the operation,

The company's web server uses the RedHat5.4 system and adopts the php + mysql + apache structure. as the center supervisor, I am familiar with iis and apache in windows, and redhat is a novice, it was not easy to spend a week in my spare time to show the true nature of the Ox.

In the course of the operation, the old man constantly searched for information and found that the network information was very complex. He said that it was neither vague nor complex. Based on my own experience, he put the tears of these days into my pen, hope to help you.



First install apache environment, go to linux first> gcc release, tar jxfv httpd-2.2.17.tar.bz2 unpackage ,. /configure -- prefix =/usr/apache2/-- enable-so, make, make install to install apache. after installing it, check netstat-nat. if there are 80 ports, the service starts, if you do not describe apache control, you should know where apachectl is. you can also add chkconfig to the system service.

# Tar jxvf httpd-2.2.17.tar.bz2

# Cd httpd-2.2.17
#./Configure -- prefix =/usr/local/apache2 -- enable-module = so
# Make
# Make install


Next is to install mysql, this is relatively simple, # rpm-ivh MySQL-server-4.0.20-0.i386.rpm, # rpm-ivh MySQL-client-4.0.20-0.i386.rpm after installation can try to use, set the password to use mqlsqladmin, use mysql connection to test whether the installation is complete.

The next step is to install php. first, to support multiple image formats, we need to install the following package:

1. install XPM

# Rpm-ivhxpm-3.4k-2.i386.rpm

Install libxml
# Tar-zxf libxml2-2.6.16.tar.gz
# Cd libxml2-2.6.16
#./Configure (xml can be installed by default, do not specify the path, because php may not find it during installation, PHP5 only supports libxml2-2.5.10 and later versions)
# Make
# Make install

Install zlib
# Tar-zxf zlib-1.2.2.tar.gz
# Cd zlib-1.2
#./Configure -- prefix =/usr/local/zlib2
# Make
# Make install

Install jpeg
# Tar-zxf restart src.v6b.tar.gz
# Cd jpeg-6b/
#./Configure -- prefix =/usr/local/Issue 6
# Make
# Make install-lib
If you choose to install it by default, it may be very smooth. after specifying the path, please first create the following folder
Error message:.../usr/bin/install-c-m 644 jconfig. h/usr/local/Issue 6/include/jconfig. h
/Usr/bin/install: The general file '/usr/local/defaults 6/include/jconfig. h' cannot be created: the file or directory does not exist.
Make: *** [install-headers] Error 1
# Mkdir/usr/local/limit 6
# Mkdir/usr/local/latest 6/include
# Mkdir/usr/local/IPv6/lib
# Make install-lib
# Make install

If an error occurs during installation:
/Usr/bin/install: The general file '/usr/local/defaults 6/lib/libjpeg. a' cannot be created: the file or directory does not exist.
Make: *** [install-lib] Error 1
Create the following folder:
# Mkdir/usr/local/IPv6/lib
# Make install
/Usr/bin/install-c cjpeg/usr/local/listen 6/bin/cjpeg
/Usr/bin/install: The general file '/usr/local/defaults 6/bin/cjpeg' cannot be created: the file or directory does not exist.
Make: *** [install] Error 1
# Mkdir/usr/local/partition 6/bin
/Usr/bin/install-c-m 644./c0000.1/usr/local/sort 6/man/man1/c0000.1
/Usr/bin/install: The general file '/usr/local/Hangzhou 6/man/man1/c0000.1' cannot be created: the file or directory does not exist.
Make: *** [install] Error 1
# Mkdir/usr/local/IPv6/man
# Mkdir/usr/local/IPv6/man/man1
# Make install
Okay, until the installation is successful!

Install libpng:
# Tar-zxf libpng-1.2.7-config.tar.gz
# Cd libpng-1.2.7-config
#./Configure -- prefix =/usr/local/libpng2
# Make
# Make install

Install freetype:
# Tar-zxf freetype-2.1.9.tar.gz
# Cd freetype-2.1.9
#./Configure -- prefix =/usr/local/freetype2
# Make
# Make install

Install the gd Library:
# Tar-zxf gd-2.0.26gif.tar.gz
# Cd gd-2.0.26gif
#. /Configure -- prefix =/usr/local/gd2 -- with-zlib =/usr/local/zlib2/-- with-png =/usr/local/libpng2/-- with-jpeg = /usr/local/Release 6/-- with-freetype =/usr/local/freetype2/(specify the installation path of the pass plug-in, otherwise, an error may occur when installing php !)
# Make
# Make install

Install php5:
# Tar-zxf php5-200411260130.tar.gz
# Cd php5-200411260130
#. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-jpeg-dir =/usr/local/defaults 6/-- -png-dir =/usr/local/libpng2/-- with-gd =/usr/local/gd2/-- with-freetype-dir =/usr/local/freetype2/-- -zlib-dir =/usr/local/zlib2/-with-mysql =/var/lib/mysql
# Make
# Make install
# Cp php. ini-dist/usr/local/php/lib/php. ini
Make test is required before make. several packages are required: openssl, mysql-shared, mysql-devel, and so on.


Error: gd_png.c: 16: 53: error: png. h: No such file or directory2011-03-04 21:40 compile gd-2.0.35.tar.gz when compiling gd-2.0.35.gz:



Gcc-DHAVE_CONFIG_H-I. -I. -I. -I/usr/local/freetype/include/freetype2-I/usr/local/freetype/include-I/usr/local/jpeg /include-g-O2-MT gd_png.lo-MD-MP-MF. deps/gd_png.Tpo-c gd_png.c-fPIC-DPIC-o. libs/gd_png.o
Gd_png.c: 16: 53: error: png. h: No such file or directory
Gd_png.c: 47: error: expected specifier-qualifier-list before 'jmp _ buf'
Gd_png.c: 54: error: expected ') 'before' png _ ptr'

Gd_png.c: 82: error: expected ') 'before' png _ ptr'
Gd_png.c: 92: error: expected ') 'before' png _ ptr'

Solution:

Vi gd_png.c
Set
# Include "png. h"/* includes zlib. h and setjmp. h */
Replace:
# Include "/usr/local/libpng/include/png. h"/* includes zlib. h and setjmp. h */


Copy the PHP. ini file to the correct location.
Run in the PHP Directory
# Cp php. ini-dist/usr/local/php/lib/php. ini

Edit the apache configuration file httpd. conf.
# Vi/usr/local/apache2/conf/httpd. conf

You need to modify the following items:

Generally
# AddType application/x-tar. tgz
Add a row below
# LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php. php
If you do not search for any of the following items

LoadModule php5_module modules/libphp5.so
Remove the # above

Also found
DirectoryIndex index.html. var
Add index. php to the end to make index. php a response page.


Find
# ServerName
Remove #, and change the following IP address to your IP address.

Find
DocumentRoot "/usr/local/apache2/htdocs"
Change/usr/local/apache2/htdocs to the path where your webpage files are stored.

Save the httpd. conf file.

Start apache
#/Usr/local/apache2/bin/apachectl start
Selinux security mechanisms can also cause some strange problems, one of which can

Chcon-c-v-R-u system_u-r object_r-t textrel_shlib_t/usr/local/apache2/modules/libphp5.so
Solution.

Edit Save it as index. php and put it in the set Directory. you can see the php information. this is a success.

 

During the installation process, do not mess up and install all the required packages. do not ignore the error message. In addition, make uninstall may often be used.

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.