Build Apache + PHP + MySQL + Zend + GD library

Source: Internet
Author: User
Tags apache php php mysql xsl xslt
Install the MYSQL5.0 server first (after installation, the default user name is root and the default password is mysql)
Which of the following statements is compiled during download?
Decompress MySQL and copy all files to/usr/local/mysql.
[Root @ Bleach usr] # groupadd mysql
[Root @ Bleach usr] # useradd-g mysql
[Root @ Bleach mysql] # cd mysql
[Root @ Bleach mysql] # scripts/mysql_install_db -- user = mysql
[Root @ Bleach mysql] # chown-R root.
[Root @ Bleach mysql] # chown-R mysql data
[Root @ Bleach mysql] # chgrp-R mysql.
[Root @ Bleach mysql] #./bin/mysqld_safe -- user = mysql &
[Root @ Bleach mysql] #./bin/mysqladmin-u root password mysql
[Root @ Bleach mysql] # cp./support-files/mysql. server/etc/init. d/mysql
[Root @ Bleach mysql] # cd/etc/rc3.d/
[Root @ Bleach rc3.d] # ln-s/etc/init. d/mysql S85mysql
[Root @ Bleach rc3.d] # ln-s/etc/init. d/mysql K85mysql
Install GD library Basic Package gd-devel
# Rpm-ivh gd-devel-1.8.4-11.i386.rpm
Install XPM support
# Rpm-ivh xpm-3.4k-2.i386.rpm
Install libxml2 (remember PHP5.1.1 only supports libxml2-2.6.11 or above)
# Tar zxvf libxml2-2.6.11.tar.gz
# Cd libxml2-2.6.11
#./Configure
# Make
# Make install
Start to install GD library support
-------------------------------------------------------
Install the GD basic rpm package first
# Rpm-ivh gd-devel.rpm
ZLIB
#./Configure
# Make
# Make install
JPEGSRC
#./Configure -- enable-shared
# Make
# Make install-lib
# Make install
LIBPNG
# Cp scripts/makefile. std Makefile
# Make
# Make install
Last is GD2 .*
#./Configure -- with-png =/usr/local -- with-jpeg =/usr/local -- with-freetype =/usr
# Make
# Make install
----------------------------------------------
If everything above is successful, GD will be successfully installed. If there is a problem, it should be a lack of support packages. In short, if there is nothing to download
Install it.
Next, install APAHCHE2 and PHP5.
#./Configure -- prefix =/usr/local/apache2 -- enable-module = so
# Make
# Make install
PHP5
#. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-jpeg-dir =/usr/local -- with-png- dir =/usr/local -- with-gd =/usr/local -- enable-trace-vars -- with-zlib-dir =/usr/local-with-mysql =/usr/ local/mysql -- enable-mbstring = all
# Make
# Make install
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
AddType application/x-httpd-php. php
Search
Index.html
Add index.htm index. php to make index. php a response page.
Find
# ServerName
Remove #, and change the following IP address to your IP address.
Find
"/Usr/local/apache2/htdocs"
Change "/usr/local/apache2/htdocs" to the path where your webpage files are stored.
Save the httpd. conf file.
Start it
#/Usr/local/apache2/bin/apachectl start
If no error occurs, write a test page and put it in your webpage directory.
Phpinfo ();
?>
Save. Try IP address in the tester to view the PHPINFO page.
Add Apache2 to System Service
# Cd/etc/init. d
# Cp/usr/local/apache/bin/apachectl./httpd
Edit/etc/init. d/httpd in text
Add in the header
# Chkconfig: 345 79 15
# Description: Activates/Deactivates Apache Web Server
# Processname: httpd
# Chkconfig -- add httpd
Installing ZendOptimizer-2.5.3 acceleration PHP
#./Install. sh
------------------------
I have always wanted to write a detailed installation and configuration article on the PHP environment in Linux.
I would like to take the opportunity to write out the installation and configuration steps for beginners to refer!
If you have any mistakes, please testify against them. Thank you! -By Mayer
First, I created a soft folder under the/root directory to save the source package I want to install.
Mkdir/root/soft
Cd/root/soft
First, find the URL for downloading the apache php mysql proftpd source package.
Browse
Http://www.apache.org

Http://www.php.net

Http://www.mysql.com
Http://www.proftpd.org/
And other official websites
Direct download using wget
Wget
Http://apache.justdn.org/httpd/http
...
Wget
Http://cn.php.net/get/php-5.0.5.tar
...
Wget
Http://dev.mysql.com/get/Downloads/
...
Step 1: install apache
Note: The current directory is/root/soft,
Directory has
Httpd-2.0.55.tar.gz, php-5.0.5.tar.gz
And other Binary source code packages
# Indicates the root permission. # A command is entered.
Run the following command:
Decompress the source package
# Tar-zxf httpd-2.0.55.tar.gz
Go to the installation directory
# Cd httpd-2.0.55
Configure apache installation information
#./Configure -- prefix =/usr/local/apache -- enable-modules = so -- enable-rewrite
Execute make to install
# Make; make install
After installation
# Vi/usr/local/apache/conf/httpd. conf
Find
MaxClients 150
Change
ServerLimit 2000
MaxClients 1000
By default, apache works in prefork. c mode, and the number of concurrent processes is 150, which cannot be accessed after it is exceeded. 150 is far from enough. Therefore, we need to change it as needed on our own website, such as 1000.
Because the default maximum number of concurrent processes in apache is 256, you must set ServerLimit 2000 to set the maximum number of concurrent processes available on the server to 2000, and then set the maximum number of concurrent processes to MaxClients 1000.

Find # ServerName
Www.example.com: 80
Set ServerName below:
ServerName
Www.mysite.com
Base
Www.mysite.com
Your website name can also be replaced by an IP address
Find DocumentRoot "/usr/local/apache/htdocs"
Set the root directory of your WEB server as shown in Figure
DocumentRoot "/myweb"
Change DirectoryIndex index.html. var
DirectoryIndex index.html index. php index.htm
Find ForceLanguagePriority Prefer Fallback and add
Adddefacharcharset gb2312
Save the changes (for the vi usage, check the Linux vi command)
Run the following command to start the WEB Server:
#/Usr/local/apache/bin/apachectl start
Check whether your site is normal
Http://www.mysite.com
Available IP addresses
Stop the service with #/usr/local/apache/bin/apachectl stop
Install MYSQL
# Tar-zxf mysql-standard-5.0.15-linux-i686.tar.gz
# Cp-r mysql-standard-5.0.15-linux-i686/usr/local/mysql
# Vi/usr/local/mysql/support-files/my-medium.cnf.
Add
Max_connections = 1000
Log-slow-queries
Long_query_time = 5
Note: max_connections indicates the maximum number of connections allowed.
Log-slow-queries
Long_query_time: the number of seconds for low-speed query (running an SQL statement at this time is recorded in the log)
COPY it to the/etc/my. cnf file.
# Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
Add mysql users and user groups
# Groupadd mysql
# Useradd-g mysql
Modify mysql Directory Permissions
# Chown-R root/usr/local/mysql
# Chgrp-R mysql/usr/local/mysql
# Chown-R mysql/usr/local/mysql/data
Generate mysql System Database
#/Usr/local/mysql/scripts/mysql_install_db -- user = mysql &
Start mysql Service
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql &
If Starting mysqld daemon with databases from/usr/local/mysql/data appears
The mysql service is started normally. Press Ctrl + C to jump out.
Modify the root password of mysql
#/Usr/local/mysql/bin/mysqladmin-u root-p password 123456
Enter password when you press Enter: the initial password is empty by default. Continue to press Enter.
123456 is your new password
Install the GD library (for PHP to support GIF, PNG, and JPEG)
Download IIS6, libpng, and freetype and install the module.
Wget
Http://www.ijg.org/files/jpegsrc.v6
...
Wget
Http://nchc.dl.sourceforge.net/sour
...
Wget
Http://keihanna.dl.sourceforge.net/
...
Wget
Http://www.boutell.com/gd/http/gd-2
...
Install IIS6
Create directory
# Mkdir/usr/local/limit 6
# Mkdir/usr/local/partition 6/bin
# Mkdir/usr/local/IPv6/lib
# Mkdir/usr/local/latest 6/include
# Mkdir/usr/local/IPv6/man
# Mkdir/usr/local/IPv6/man/man1
# Cd/root/soft
# Tar-zxf restart src.v6b.tar.gz
# Cd jpeg-6b
#./Configure -- prefix =/usr/local/defaults 6/-- enable-shared -- enable-static
# Make; make install
Install libpng
# Cd/root/soft
# Tar-zxf libpng-1.2.8.tar.gz
# Cd libpng-1.2.8
# Cp scripts/makefile. std makefile
# Make; make install
Install freetype
# Cd/root/soft
# Tar-zxf freetype-2.1.10.tar.gz
# Cd freetype-2.1.10
#./Configure -- prefix =/usr/local/freetype
# Make; make install
Install the latest GD library
# Cd/root/soft
# Tar-zxf gd-2.0.33.tar.gz
# Cd gd-2.0.33
#. /Configure -- prefix =/usr/local/gd2 -- with-jpeg =/usr/local/versions 6/-- with-png -- with-zlib -- with-freetype =/usr/local /freetype/
# Make; make install
Install the latest Curl Library
# Cd/root/soft
# Wget
Http://curl.haxx.se/download/curl-7
...
# Tar-zxf curl-7.15.0.tar.gz
#./Configure -- prefix =/usr/local/curl
# Make; make install
Install PHP
Because php5 requires libxml2 support, download and install libxml2 first.
# Cd/root/soft
# Wget
Http://ftp.gnome.org/pub/GNOME/sour
...
# Tar-zxf libxml2-2.6.19.tar.gz
# Cd libxml2-2.6.19
#./Configure -- prefix =/usr/local/libxml2
# Make; make install
Install libxslt
# Cd/root/soft
# Wget
Http://ftp.gnome.org/pub/GNOME/sour
...
# Tar-zxf libxslt-1.1.15.tar.gz
# Cd libxslt-1.1.15
#./Configure -- prefix =/usr/local/libxslt -- with-libxml-prefix =/usr/local/libxml2
# Make; make install
# Tar-zxf php-5.0.5.tar.gz
# Cd php-5.05
#./Configure -- prefix =/usr/local/php
-- With-apxs2 =/usr/local/apache/bin/apxs -- with-mysql =/usr/local/mysql/
-- With-curl =/usr/local/curl -- enable-ftp
-- With-libxml-dir =/usr/local/libxml2 -- with-expat-dir =/usr/lib
-- Enable-soap -- with-xsl =/usr/local/libxslt -- enable-xslt
-- With-gd =/usr/local/gd2/-- with-jpeg-dir =/usr/local/limit 6/
-- With-zlib-dir =/usr/lib -- with-png
-- With-freetype-dir =/usr/local/freetype
# Make
# Make install
The./configure
-- Prefix =/usr/local/php
-- With-apxs2 =/usr/local/apache/bin/apxs
-- With-mysql =/usr/local/mysql/
-- With-libxml-dir =/usr/local/libxml2
Is a required Option
-- With-gd =/usr/local/gd2/
-- With-jpeg-dir =/usr/local/defaults 6/
-- With-png
-- With-zlib-dir =/usr/lib
-- With-freetype-dir =/usr/local/freetype
This is the configuration option for PHP to support the GD library
-- With-curl =/usr/local/curl supports CURL Library
-- Enable-ftp support for opening FTP library functions
-- Enable-soap -- with-xsl =/usr/local/libxslt -- enable-xslt
Let PHP support SOAP, which is usually used less and can be removed
Configure httpd. conf to make apache support PHP
# Vi/usr/local/apache/conf/httpd. conf
Find AddType application/x-gzip. gz. tgz and add the following content under it:
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
Restart apache
#/Usr/local/apache/bin/apachectl restart
Create a PHP file in your Web directory and enter the URL to check whether the PHP configuration is correct.
Install phpmyadmin
Download
# Cd/root/soft
# Wget
Http://nchc.dl.sourceforge.net/sour
...
# Tar-zxf phpMyAdmin-2.6.4-pl3.tar.gz
# Vi phpMyAdmin-2.6.4-pl3/config. inc. php
Find $ cfg ['servers'] [$ I] ['auth _ type'] = 'config'; change config to http
After saving
Music phpMyAdmin-2.6.4-pl3/Your phpmyadmin directory
How to solve the problem of Chinese garbled characters in MySQL 4.0-4 port old database
Go to phpmyadmin Management
Create your database name and select gb2312_bin encoding.
Then import the SQL file you have backed up. Select the character set of the file during import: gb2312.
OK after completion
Note: After PHP connects to the mysql4.1 and 5.0 databases, you must specify the character SET for execution such as mysql_query ("set names 'gb2312 '");

Otherwise, Chinese garbled characters are generated!

Install ZendOptimizer

Copy the manually downloaded/usr/ports/distfile/ZendOptimizer-2.5.10a-freebsd5.1-i386.tar.gz to/tmp:

Code:
# Tar-xzf ZendOptimizer-2.5.10a-freebsd5.1-i386.tar.gz
# Cd ZendOptimizer-2.5.10a-freebsd5.1-i386
#./Install. sh
Tip:
Code:
/Usr/libexec/ld-elf.so.1: Shared object "libcrypt. so.2" not found, required by "php"

So:
Code:
Fb60 # find/-name "libcrypt. so"
/Usr/lib/libcrypt. so
Next:
Code:
Ln-s/usr/lib/libcrypt. so/usr/lib/libcrypt. so.2
Then install the SDK, and the following message is displayed:
Code:
Fb60 #./install. sh
/Usr/libexec/ld-elf.so.1: Shared object "libm. so.3" not found, required by "php"
Next, find and connect:
Code:
Fb60 # find/-name "libm. so"
/Usr/lib/libm. so
^ C
Fb60 # ln-s/usr/lib/libm. so/usr/lib/libm. so.3
After installation, the following message is displayed:
Code:
Fb60 #./install. sh
/Usr/libexec/ld-elf.so.1: Shared object "libc. so.5" not found, required by "php"
Connect:
Code:
Fb60 # ln-s/usr/lib/libc. so/usr/lib/libc. so.5
Install again. OK. Follow the prompts below.
Now my phpinfo () prompt is as follows:
Code:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.8, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.5.10, Copyright (c) 1998-2005, by Zend Technologies

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.