PHP development environment under Linux build-php,mysql,apache

Source: Internet
Author: User
Tags php development environment
Original url:http://blog.sina.com.cn/s/blog_4b029ef301007xky.html

Software Installation List

Zlib.

Mysql

Php

http

Libpng

FreeType

Jpegsrc

Libxml

I use the source code installation, because it is more flexible, you can specify the installation directory and configuration parameters, or the selection and optimization of features.

Description: All packages are installed in the/data directory.

(1):
Installing zlib
Tar zxvf zlib-1.2.3.tar.gz
CD zlib-1.2.3
./configure--prefix=/data/zlib
Make
Make install
Then add the/etc/ld.so.conf in the
/data/zlib/lib
Save, execute Ldconfig-v
(2) MySQL installing.
#groupadd MySQL
#useradd-G MySQL MySQL
# Vi/home/mysql/.bash_profile
Add to
Export path= $PATH:/data/mysql/bin
After saving, go to the directory where the installation package is located, first install MySQL
Unzip:
TAR-ZXVF mysql-5.0.45.tar.gz
CD mysql-5.0.45

Next to the Configure configuration, in the past I just worked out the prefix did not set the font encoding, the result PHP later does not support Chinese character coding, had to reinstall
Only to notice this problem, and we have installed the zlib, we can give MySQL to indicate the location of zlib
[Root@cme_box mysql-5.0.45]#./configure--prefix=/data/mysql--with-zlib-dir=/data/zlib/--with-charset=utf8-- With-extra-charsets=gbk,gb2312,utf8
Make
Make install
Again, add a row to the/etc/ld.so.conf
/data/mysql/lib/mysql
Save, execute Ldconfig-v
#./scripts/mysql_install_db
#chown-R Root/data/mysql
#chown-R Mysql/data/mysql/var
#chgrp-R Mysql/data/mysql
# CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
#/data/mysql/bin/mysqld_safe &
Set the MySQL self-boot down again in INIT.D.
# CP Support-files/mysql.server/etc/init.d/mysql
Cd/etc/rc3.d
Ln-s. /init.d/mysql S85mysql
Ln-s. /init.d/mysql K85mysql
Cd.. /rc5.d/
Ln-s. /init.d/mysql S85mysql
Ln-s. /init.d/mysql K85mysql
Cd.. /init.d
chmod 755 MySQL
Then reboot check to see if MySQL is started.
(3) Installing Apache
TAR-ZXVF httpd-2.2.6.tar.gz
CD httpd-2.2.6
./configure--prefix=/data/httpd/--enable-so--enable-cgi--with-z=/data/zlib
Make
Make install
Cp/data/httpd/bin/apachectl/etc/init.d/httpd
Cp:overwrite '/etc/init.d/httpd '? Y
Cd/etc/rc3.d
RM-FR k15httpd
Cd/etc/rc5.d
RM-FR k15httpd
Cd/etc/rc3.d
Ln-s. /INIT.D/HTTPD k85httpd
Ln-s. /INIT.D/HTTPD s85httpd
Cd/etc/rc5.d
Ln-s. /INIT.D/HTTPD k85httpd
Ln-s. /INIT.D/HTTPD s85httpd
chmod 755/etc/init.d/httpd
(4) Install GD Library
First, we want to install the support of various graphics libraries, including libpng, Libjpeg,ttf and so on.
1) libpng
TAR-ZXVF libpng-1.2.23.tar.gz
./configure--prefix=/data/libpng
Make
Make install
Then add the path of the libpng (/data/libpng/lib) to/etc/ld.so.conf and execute the LDCONFIG-V
Can see
/data/libpng/lib:
Libpng.so.3-libpng.so.3.23.0
libpng12.so.0-libpng12.so.0.23.0
This item. Indicates that the installation was successful.
2) FreeType
TAR-ZXVF freetype-2.1.10.tar.gz
CD freetype-2.1.10
./configure--prefix=/data/freetype
Make
Make install
Then add the path of FreeType (/data/freetype/lib) to/etc/ld.so.conf and Run command "Ldconfig-v", we can get
The output
/data/freetype/lib:
Libfreetype.so.6-libfreetype.so.6.3.8
3) JPEG
TAR-ZXVF jpegsrc.v6b.tar.gz
./configure--prefix=/data/jpeg--enable-shared
Make
Make install
Tip:/usr/bin/install:cannot Create regular file '/data/jpeg/include/jconfig.h ': No such file or directory
Nnd, found on the CU, the original installation program does not have permissions to create a directory under/data, you need to manually create
When I create the Include directory, I am prompted that the Lib directory does not exist, after creating the Lib directory, and prompted the Man/man1 directory does not exist, then create it one by one.
Cd/data/jpeg
MkDir include Lib man bin
mkdir Man/man1
Then make install is OK.
Then add a line/data/jpeg/lib in the/etc/ld.so.conf, execute the command ldconfig-v, and you can see
/data/jpeg/lib:
libjpeg.so.62-libjpeg.so.62.0.0
4) Install Fontconfig

TAR-ZXVF fontconfig-2.5.0.tar.gz

CD fontconfig-2.5.0
./configure--prefix=/data/fontconfig--with-freetype-config=/data/freetype/bin/freetype-config

Make

Make install

Cd/data/fontconfig/lib

PWD >>/etc/ld.so.conf

Ldconfig-v | grep fontconfig

Installing GD
TAR-ZXVF gd-2.0.33.tar.gz
./configure--prefix=/data/gd--with-png=/data/libpng--with-freetype=/data/freetype--with-jpeg=/data/jpeg-- With-fontconfig=/data/fontconfig

(in the past without adding fontconfig time, will report this mistake, but 2008-12-15 added fontconfig, but no error, all the way make,make install very smooth, but still to write on, In case of another encounter: make when the system is prompted to find Png.h, manually modify the Makefile
At cppflags = end of line plus-i/data/libpng/include
At the end of cflags =-g-o2 Line Plus
-dhave_jpeg-dhave_libttf-dhave_png
Revision changed to
CFLAGS =-g-o2-dhave_jpeg-dhave_libttf-dhave_png
)

And then
Make
Make install
(4) Installation Libxml
TAR-ZXVF libxml2-2.6.11.tar.gz
./configure--prefix=/data/xml--with-zlib=/data/zlib
Make
Make install
The XML Library Path "/data/xml/lib/" is then added to the/etc/ld.so.conf file after it is saved and executed ldconfig-v
See
/data/xml/lib:
Libxml2.so.2-libxml2.so.2.6.11
Add GD's library path [/data/gd/lib] to etc/ld.so.conf file, execute ldconfig-v
(5) Installing PHP
TAR-ZXVF php-5.2.4.tar.gz
./configure--prefix=/data/php--with-zlib-dir=/data/zlib--with-mysql=/data/mysql--with-apxs2=/data/httpd/bin/ Apxs--with-config-file-path=/data/php--with-gd--enable-sysvmsg--enable-sockets--enable-sysvshm--enable-sysvsem --enable-gd-native-ttf--with-ttf=/usr/lib--with-jpeg-dir=/data/jpeg--with-png-dir=/data/libpng--with-iconv-- With-libxml-dir=/data/xml
Make
Make install

CP Php.ini-dist/data/php/php.ini


(6) Set up PHP support in http.conf.
Vi/data/httpd/conf/http.conf
In
# Example:
# LoadModule Foo_module modules/mod_foo.so
LoadModule Php5_module modules/libphp5.so
Add a row below
AddType application/x-httpd-php. php
and will

DirectoryIndex index.html

Revision changed to

DirectoryIndex index.php index.html

Set the default home page to index.php
Then add a row in the/data/php/php.ini
Default_charset = "gb2312"
Save
Service httpd Restart
To test
Build index.php under the/data/httpd/htdocs/
Write content to Save
Open page Enter URL address
http://192.168.x.x/
You can see the output of the phpinfo.
If you want to modify the default root directory of HTTP, or if you do not want to put your own files in the/data/httpd/htdoc directory
You can modify the httpd.conf in the
DocumentRoot "/data/httpd/htdoc" for
DocumentRoot "/cme/web"
And to be

And then add the permissions to the new directory that you can execute.
chmod +X/CME
chmod +x/cme/web
Restart Service httpd Restart
It's OK.

  • 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.