Linux under the apache+mysql+php operating environment to build a course

Source: Internet
Author: User
Tags anonymous soap localhost mysql mkdir mysql client php server file permissions

PHP Server Environment build installation software preparation

1. Apache224.tar.gz
2. php-5.2.9.tar.gz
3. mysql-5.1.54.tar.gz
PHP and individual component packages
Libxml2-2.6.30.tar.gz
XML C language version of the parser
Libmcrypt-2.5.8.tar.gz
Cryptographic Algorithm Extension Library
Zlib-1.2.3.tar.gz
Compress image Components
Gd-2.0.35.tar.gz
API for working with pictures
Autoconf-2.61.tar.gz
Shell scripts that automatically configure source code
Freetype-2.3.5.tar.gz
function library for manipulating fonts
Libpng-1.2.26.tar.gz
Library to parse PNG image format
Jpegsrc.v6b.tar.gz
Zendoptimizer-3.3.0a-linux-glibc21-i386.tar.gz
Zend Accelerator Installation
Libxml2-2.6.30.tar.gz
1. Decompression libxml2-2.6.30.tar.gz
Tar zxvf libxml2-2.6.30.tar.gz
2. Configure libxml2-2.6.30
CD libxml2-2.6.30
./configure–prefix=/usr/local/libxml
23. Compile

Make

4. Installation

Make install

If the installation is successful, the bin, include, Lib, man, and share five directories will be generated under the/usr/local/libxml2/directory.

Install libmcrypt-2.5.8.tar.gz
1. Decompression libmcrypt-2.5.8.tar.gz
Tar zxvf libmcrypt-2.5.8.tar.gz
2. Configure CD libmcrypt-2.5.8.tar.gz
./configure–prefix=/usr/local/libmcrypt
3. Compile
Make
4. Installation
Make install
If the installation succeeds, the bin, include, Lib, man, and share five directories are generated in the/usr/local/libmcrypt/directory.
Install zlib-1.2.3.tar.gz
1. Decompression zlib-1.2.3.tar.gz
Tar zxvf zlib-1.2.3.tar.gz
2. Configure CD zlib-1.2.3.
./configure–prefix=/usr/local/zlib
3. Compile
Make
4. Installation
Make install
If the installation succeeds, the include, Lib, and share three directories will be generated in the/usr/local/zlib directory.
Install libpng-1.2.26.tar.gz
1. Decompression libpng-1.2.26.tar.gz
Tar zxvf libpng-1.2.26.tar.gz
2. Configure
CD libpng-1.2.26
./configure–prefix=/usr/local/libpng
3. Compile
Make
4. Installation
Make install
If the installation succeeds, the bin, include, Lib, and share four directories will be generated in the/usr/local/libpng directory.
Install jpegsrc.v6b.tar.gz
1. Set up the corresponding catalogue
(1) Establishment of JPEG6 software installation directory
Mkdir/usr/local/jpeg6
(2) Create a directory for storing commands
Mkdir/usr/local/jpeg6/bin
(3) Set up directory of Jpeg6 library files
Mkdir/usr/local/jpeg6/lib
(4) Set up the directory of the storage header file
Mkdir/usr/local/jpeg6/include
(5) Set up a catalogue of storage manuals
Mkdir/usr/local/jpeg6/man/man1
2. Decompression jpegsrc.v6b.tar.gz
Tar zxvf jpegsrc.v6b.tar.gz
3. Configure CD JPEG-6B
./configure–prefix=/usr/local/jpeg6
Install software into the/usr/local/jpeg6 directory at install time
--enable-shared
Create a shared library using the GNU Libtool
--enable-static
Build a static library using the GNU Libtool
4. Compile
Make
5. Installation
Make install
Install freetype-2.3.5.tar.gz
1. Decompression freetype-2.3.5.tar.gz
Tar zxvf freetype-2.3.5.tar.gz
2. Configure CD freetype-2.3.5
./configure--prefix=/usr/local/freetype
3. Compile
Make
4. Installation
Make Intall
Install autoconf-2.61.tar.gz
1. Decompression autoconf-2.61.tar.gz
Tar zxvf autoconf-2.61.tar.gz
2. Configure
CD autoconf-2.61
./configure
3. Compile
Make
4. Installation
Make install
Install gd-2.0.35.tar.gz
1. Decompression gd-2.0.35.tar.gz
Tar zxvf gd-2.0.35.tar.gz
2. Configure
CD gd-2.0.35
./configure–prefix=/usr/local/gd2/
--with-zlib=/usr/local/zlib/
Specify the location of the zlib library file
--with-jpeg=/usr/local/jpeg6/
Specify the location of the Jpeg6 library file
--with-png=/usr/local/libpng/
Specify the location of the PNG library file
--with-freetype=/usr/local/freetype
Specifies the location of the Freetype2 font library file
3. Compile
Make
4. Installation
Make install
Note: An error occurred while installing
MAKE[2]: * * * [Gd_png.lo] Error 1make[2]: Leaving directory '/tmp/gd-2.0.26gif ' make[1]: * * * [all-recursive] Error 1make[1] : Leaving directory '/tmp/gd-2.0.26gif ' make: * * * [ALL] Error 2
[Root@rhel3 gd-2.0.26gif]#
Solving method
CD gd-2.0.35
VI gd_png.c
Find "png.h" and change it to "/usr/local/libpng/include/png.h."


One
Apache Installation
1. Decompression Apache224.tar.gz
Tar zxvf Apache224.tar.gz
2. Directory of implementation./configure--prefix= Installation
./configure
>--prefix=/usr/local/apache2
Specify the location of the Apache software installation
>--sysconfdir=/etc/httpd
Specify the location of the Apache server's configuration file
>--with-z=/usr/local/zlib/
Specify the location of the zlib library file
>--WITH-INCLUDED-APR
Use a copy of the bundled Apr/apr-util
>--disable-userdir
The image of the request to the user-specific directory
>--enable-so
Compiling with dynamic shared objects (DSO)
>--enable-deflate=shared
Support for narrowing transmission coding
>--enable-expires=shared
Expiration Head Control
>--enable-rewrite=shared
rule-based URL Manipulation
>--enable-static-support
3. Execute make
Make
4 Execute make Install
Make install
5.apache Installation Successful
6. Configure Apache to open Apache configuration file vi/usr/local/conf/httpd.conf Partial configuration entry description after successful installation
(1) Apache installation directory ServerRoot "Current installation directory" such as:
ServerRoot "/usr/local/apache"
(2) Apache uses the port listen port [1-65535 One any, the general default is 80]
Listen 80
(3) Server root directory is User access directory DocumentRoot "root directory"
DocumentRoot "/usr/local/apache/htdocs"
(4) The server index file is returned to the user by default DirectoryIndex index file name
DirectoryIndex index.html
7. Modify the file owner and all groups
Cd/usr/local/apache
Chown–r Nobody:root./htdocs
8. Modify all file permissions under Apache
Cd/usr/local/apachechmod–r 755 *
9. Start Apache
Cd/usr/local/apache/bin
./apachectl Start
10. Restart Apache
Cd/usr/local/apache/bin
./apachectl Restart
The Mod_proxy and mod_rewrite modules cannot be found after installation, mainly because APACHE2.2 default installation options are minimized, and some extension modules are not installed in the default state, if necessary, after the./configure. For example, to use the Mod_proxy and mod_rewrite two modules to experiment, so the command line is:
./configure--enable-mods-shared= ' proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_rewrite
This configuration not only specifies these modules, but also installs the other minimum items by default. After this is configured, both Mod_proxy and mod_rewrite two modules can be found after the make and make install are installed. You can also add the following configuration items when you install Apache
>--prefix=/usr/local/apache2
Specify the location of the Apache software installation
>--sysconfdir=/etc/httpd
Specify the location of the Apache server's configuration file
>--with-z=/usr/local/zlib/
Specify the location of the zlib library file
>--WITH-INCLUDED-APR
Use a copy of the bundled Apr/apr-util
>--disable-userdir
The image of the request to the user-specific directory
>--enable-so
Compiling with dynamic shared objects (DSO)
>--enable-deflate=shared
Support for narrowing transmission coding
>--enable-expires=shared
Expiration Head Control
>--enable-rewrite=shared
rule-based URL Manipulation
>--enable-static-support
Support for establishing a static link version
12. Set Apache boot automatically
Vi/etc/rc.d/rc.local
Add on last line
/usr/local/apache/bin/apachectl start
can also be directly executed
echo "/usr/local/apache/bin/apachectl start" >>/etc/rc.d/rc.local
installation of MySQL
1. Increase the number of logged-in users and user groups for mysqld
Groupadd mysqluseradd–g MySQL MySQL
2. Extract mysql-5.1.54.tar.gz tar zxvf mysql-5.1.54.tar.gz
3. Configure
./configure
>--prefix=/usr/local/mysql
Installing software into the/usr/local/mysql directory
>--with-extra-charsets=all
Install all character sets by default
4. Compile
Make
5. Installation
Make install
6. To create a MySQL profile, you can copy the My-medium.cnf file in the Support-files directory in the source package as a template, replicate it to the/etc/directory, and rename it to MY.CNF
CD mysql-5.1.54
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
7. If you have not installed MySQL, you need to create a MySQL authorization table is actually initializing the database. Enter the directory specified by the-prefix configuration entry in the installation directory here is "/usr/local/mysql", execute the mysql_install_db script in the bin directory to initialize the MySQL database authorization table, which stores the database server access permission.
Cd/usr/local/mysql
bin/mysql_install_db--user=mysql
8. If you use the root user to run the above command, you should use the--user option, which should be the same as the login account (MySQL user) you created for running the server in the first step. If you are using the MySQL user login to run the above command, you can omit the--user option. After you create the MySQL authorization table with mysql_install_db, you need to restart the server manually. Change the ownership of the program binaries to root, and the data directory will change to the MySQL user running the MYSQLD program. If you are now in the installation directory (/USR/LOCAL/MYSQL)


Chown-r Root./
Change all properties of a file to root
Chown-r mysql var
Change all properties of data directory to MySQL user
Chgrp-r MySQL
Change group properties to MySQL Group
9. After the required things have been installed, you should use the following command to start the MySQL service, the command line is as follows:
/usr/local/mysql/bin/mysqld_safe--user=mysql &
After the MySQL database service starts, check to see if its port 3306 is open, and if you see the following results, the MySQL service started successfully. The command line is as follows:
NETSTAT–TNL | grep 3306
10. Use Mysqladmin to verify that the server is running.
11. Access rights, in the MySQL installation process, the use of the MYSQL_INSTALL_DB program to install the MySQL Database authorization table, the table defines the initial MySQL user account and access rights, all the initial account has no password. These accounts are super user accounts and can perform any operation. The initial root account password is empty, so anyone can use the root account without any password to connect to the MySQL server and have all the permissions, which means that the MySQL installation is not protected. If you want to prevent clients from using a password to connect with anonymous users, you should specify a password for the anonymous account or delete the anonymous account, and you should specify a password for the MySQL root account. Use "Mysql–u root" to start the MySQL client console and connect to the MySQL server. If an anonymous account exists, it has full privileges, so deleting it can improve security by executing the SQL statement on the MySQL client as follows:
Bin/mysql-u Root
No password to log on to the local server directly
Welcome to the MySQL Monitor. Commands End With; or g.your MySQL connection ID is 3Server version:5.0.41-log Source distributiontype ' help; ' or ' H '. Type ' C ' to clear the buffer.
Mysql> DELETE from mysql.user WHERE host= ' localhost ' and user= ';
Query OK, 1 rows affected (0.08 sec)
mysql> FLUSH privileges;
Query OK, 1 rows affected (0.01 sec)
12. You can specify a password for the root account in several ways, one of which we choose. Using on the MySQL client command line
SET PASSWORD
To specify a password, be sure to use the password () function to encrypt the password. For example, set the password for the localhost field to "123456". Other domains can use the same statement, using the following SQL statement:
mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' 123456 ');
Query OK, 0 rows Affected (0.00 sec)
If you want to exit the MySQL client, you can exit from the MySQL client by entering the command "exit" or "quit" at the MySQL client prompt, and by pressing the keyboard "CTRL + C" key combination. Because the MySQL server has been set to the root account password, so login MySQL client will provide a password to enter. The console commands for exiting the MySQL client and restarting the MySQL client are as follows:
13. If you want to shut down the MySQL server, use the MySQL server's mysqladmin command at the command line, give the MySQL database administrator username root with the-u parameter and give the password through the-p parameter, that is, you can shut down the MySQL server. The command line is as follows:
[Root@localhost mysql]# bin/mysqladmin-u root–p shutdown
Close MySQL Database
Mysql> exit
Exit MySQL Client
Bye[root@localhost mysql]# bin/mysql-u root-h localhost–p
Enter the MySQL client
Enter Password:
14.MySQL server and Apache server is also necessary to set up for automatic operation, set the method is to enter the MySQL source code directory/usr/local/src/mysql-5.0.41/, Copy the Mysql.server file under the subdirectory support-files to the/ETC/RC.D/INIT.D directory, and rename it to "Mysqld", as shown in the following command line:
[Root@localhost mysql]# cd/usr/php/amp/amp/mysql-5.1.54
[Root@localhost mysql-5.1.54]# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
To modify the permissions for file/etc/rc.d/init.d/mysqld, the command line looks like this:
[Root@localhost mysql-5.1.54]# chkconfig--add mysqld
15. Use the Chkconfig command to set the boot policy at different system run levels, first use the "Chkconfig--add mysqld" command to increase the specified mysqld service, so that the chkconfig command to manage it, In addition, the relevant data are added in the system-initiated narrative file.
Then use the "Chconfig–level 3 mysqld on" command and the "Chconfig–level 5 mysqld on" command to open the MySQL service in the third and fifth tiers, which automatically opens the MySQL service when character mode and graphics mode is started. The order is as follows:
[Root@localhost mysql-5.0.41]# chkconfig--level 3 mysqld on
[Root@localhost mysql-5.0.41]# chkconfig--level 5 mysqld on
[Root@localhost mysql-5.0.41]# chkconfig--list mysqldmysqld
0: Close 1: Close 2: Close 3: Enable 4: Close 5: Enable 6: Off
Installation of PHP
1. Decompression php-5.2.9.tar.gz
Tar zxvf php-5.2.9.tar.gz
2. Configure CD php-5.2.9.tar.gz
./configure
Executes the configuration commands for the software's own generation under the current directory
>--prefix=/usr/local/php
To set the installation path for PHP5
>--with-config-file-path=/usr/local/php/etc
Specify the path that the PHP5 configuration file is stored in
>--with-apxs2=/usr/local/apache2/bin/apxs
Tell PHP where to find Apache 2
>--with-mysql=/usr/local/mysql/
Specify the installation directory for MySQL
>--with-libxml-dir=/usr/local/libxml2/
Tell PHP where to put the LIBXML2 library
>--with-png-dir=/usr/local/libpng/
Tell PHP where to put the libpng library
>--with-jpeg-dir=/usr/local/jpeg6/
Tell PHP where to place the JPEG library
>--with-freetype-dir=/usr/local/freetype/
Tell PHP where to put the FreeType library
>--with-gd=/usr/local/gd2/
Tell PHP where to put the GD library
>--with-zlib-dir=/usr/local/zlib/
Tell PHP where to put the zlib library
>--with-mcrypt=/usr/local/libmcrypt/
Tell PHP where to put the Libmcrypt library
>--with-mysqli=/usr/local/mysql/bin/mysql_config
Variable activation of newly added mysqli features >
--enable-soap
Variable activation soap and Web services support
>--enable-mbstring=all
Enable multibyte string support
>--enable-sockets
Variable activation socket traffic characteristics
3. Compile
Make
4. Installation
Make install
5. You need to modify the Apache configuration file, add PHP support, and tell Apache which suffixes to use as PHP parsing. For example, ask Apache to parse a file of. php or. phtml suffixes into PHP. Using VI to open Apache's profile/etc/httpd/httpd.conf, locate the "AddType application/x-gzip.gz.tgz" directive and add an instruction below it "AddType application/ x-httpd-php. php. phtml ". You can also resolve any suffix file to PHP, as long as you add a statement and separate it with a space, add one more. phtml to the example.
Vi/etc/httpd/httpd.conf
If the addencoding directives above are commented-out, then you
# Probably should define those extensions to indicate media types:addtype application/x-compress. Zaddtype application/x-gzip. GZ tgz
Add below this line
AddType application/x-httpd-php. php. phtml
#添加这一条 # Tim This one is for the syntax highlighting of. Phps as a source file for PHP
AddType Application/x-httpd-php-source. Phps
# AddHandler allows to the map certain file extensions to "handlers":
# actions unrelated to filetype. These can is either built into the server
6. After modifying the Apache configuration file, you need to reboot the server to reload the modified profile
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
7. If the php.ini configuration file is not found in the/usr/local/php/etc/directory after installation, the Php.ini-dist file can be copied to/usr/local/php/etc/in the PHP source package and renamed to PHP.ini
Install zendoptimizer-3.3.0a-linux-glibc21-i386.tar.gz
1. Decompression zendoptimizer-3.3.0a-linux-glibc21-i386.tar.gz
Tar zxvf zendoptimizer-3.3.0a-linux-glibc21-i386.tar.gz
2. Enter zendoptimizer-3.3.0a-linux-glibc21-i386
CD zendoptimizer-3.3.0a-linux-glibc21-i386
3. Perform installation
./install.sh
4. Perform the above operation will appear a graphical installation interface, as prompted to install can
5. Installation of successful environment completed! You can enjoy the power of PHP.

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.