Linux under Php+mysql+apache configuration process (excerpt) 1th/2 page _php Tutorial

Source: Internet
Author: User
Tags gettext localhost mysql phpinfo to domain
The following software is required:
apache:http://www.apache.org
Mysql:http://www.mysql.com
php:http://www.php.net/downloads.php
Gd:http://www.boutell.com/gd/#buildgd
Zendoptimizer Http://www.zend.org/products/zend_optimizer
Gettext http://ftp.gnu.org/pub/gnu/gettext/
NETPBM http://sourceforge.net/projects/netpbm/
The software version used is as follows:
Redhat Enterprise as 4
(Apache) httpd-2.0.50.tar.gz
Mysql-standard-5.0.18-linux-i686.tar.gz
Php-5.1.2.tar.gz
Gd-2.0.33.tar.gz
Zendoptimizer-2.6.2-linux-glibc21-i386.tar.gz
Imap
Gettext

One. Install MySQL mysql-standard-5.0.18-linux-i686.tar.gz
I'll download all of him to the/usr/local/software directory.
Go to the installation package directory: Cd/usr/local/software
1, [root@localhost software]# chmod 755 mysql-standard-5.0.18-linux-i686.tar.gz
2. [Root@localhost software]# tar xfz mysql-standard-5.0.18-linux-i686.tar.gz
After extracting the mysql-standard-5.0.18-linux-i686 directory, we enter the directory:
3. [Root@localhost software]# CD mysql-standard-5.0.18-linux-i686
After entering the configuration of MySQL, the configuration process we want to give MySQL to set a
Install the directory, we set under/usr/local/mysql, think to put the file in a place easier to manage, if you also want to get more configuration information, use./configure--help:
Here I would like to highlight the compile time to choose a good MySQL default code, because if you do not choose to install by default in the JSP does not support GBK encoding
So I compiled this
To access MySQL to a dedicated user, and must give the appropriate access, here we set root and MySQL has access to.
7, we first set up a MySQL and MySQL user to access MySQL:
[root@localhost mysql-standard-5.0.18-linux-i686]# groupadd MySQL #建立mysql组
8. [root@localhost mysql-standard-5.0.18-linux-i686]# useradd mysql-g MySQL #建立mysql用户并且加入到mysql组中
9, set up the user after we initialize the table (note: You must perform this step before the following steps)
[Root@localhost mysql-standard-5.0.18-linux-i686]#./scripts/mysql_install_db--user=mysql
#初试化表并且规定用mysql用户来访问初始化表以后就开始给mysql和root用户设定访问权限,;
10, [root@localhost mysql-standard-5.0.18-linux-i686]# MV Mysql-standard-5.0.18-linux-i686/usr/local/mysql
Then set permissions
Cd/usr/local/mysql

11, [root@localhost mysql]# chown-r root. #设定root能访问/usr/local/mysql
12, [root@localhost mysql]# chown-r mysql data #设定mysql用户能访问/usr/local/mysql/data, which is stored in MySQL database file
13, [root@localhost mysql]# chgrp-r MySQL. #设定mysql组能够访问/usr/local/mysql
14, the setup is finished, basically installed, well, we run our MySQL:
[Root@localhost mysql]#/usr/local/mysql/bin/mysqld_safe--user=mysql &
If there is no problem, there should be a hint like this:
[1] 42264
# starting Mysqld daemon with databases From/usr/local/mysql/var

This proves that you've got the installation done.
Use the following command to modify the root password, the default installation password is empty, for security you must immediately modify
15,/usr/local/mysql/bin/mysqladmin-uroot Password xksoft321
Now change the password to: xksoft321
16. Set Boot auto start
CP support-files/mysql.server/etc/init.d/



Second, install Apache
Go to the installation package directory: Cd/usr/local/software
1, # chmod 755 httpd-2.0.50.tar.gz
2. # tar Xfz httpd-2.0.50.tar.gz
3. # CD httpd-2.0.50
Start configuring Apache
4, #./configure--prefix=/usr/local/apache2--enable-so--enable-rewrite--enable-mods-shared=most
#./configure--prefix=/usr/local/apache2--enable-so--enable-module=most--enable-shared=max--enable-rewrite
#./configure--prefix=/usr/local/apache2--enable-so--enable-rewrite--enable-access
#./configure--prefix=/usr/local/apache2--enable-so--enable-mods-shared=all–-enable-rewrite=shared

5. # make
6. # Make Install
7, see the module compiled into Apache:
#/usr/local/apache2/bin/httpd-l
Compiled-in Modules:
Http_core.c
Mod_so.c
See the above information indicates that Apache supports the DSO mode. In this way, you can use the DSO method to add PHP and resin modules.

Iii. installation of GD
Go to the installation package directory: Cd/usr/local/software
1, TAR-ZXVF gd-2.0.33.tar.gz
2. CD gd-2.0.33
3,./configure--PREFIX=/USR/LOCAL/GD2
4. Make
5. Make install

Gettext
1. Tar Xfz
2 CD
3./configure–with-prefix=/usr/local/gettext
4 Make
5 Make Install

Iv. Installation of PHP
Go to the installation package directory: Cd/usr/local/software
1. # tar Xfz php-5.1.2.tar.gz
2, after decompression into the directory:
# CD php-5.1.2
3, the configuration, this step is more critical, be sure to set up, especially to consider what you want to support, such as GD Library, Xml,mysql and so on, if you want to know the detailed configuration, execute./configure--help to obtain:
#./configure--enable-mbstring=lang--with-mysql=/usr/local/mysql--with-gd=/usr/local/gd2--with-apxs2=/usr/local /apache2/bin/apxs–with-gettext=/usr/local/gettext
――enable-mbstring=lang (Troubleshooting PHP extension:mbstring)
If the above configuration is not wrong, then you should finally show thanks for using the words such as PHP, then prove that the configuration is successful, if the above configuration options are not supported, will prompt the error.
For example, you do not install MySQL, then--with-mysql can not be used, so be sure to note that the corresponding option system can support, if there is an error, then install the corresponding program, or remove the relevant options, the configuration will be compiled:
4. # make
"Build Complete" appears after successful compilation. , then you can install it:
5. # make Install
6. Copy the php.ini-dist to/usr/local/lib/and rename it to php.ini after the installation is complete.
# CP Php.ini-dist/usr/local/lib/php.ini
Basically here PHP is installed successfully, if there is an error in the middle, in addition to the configuration when there is no selection of the option after the general error.
7, in order to allow Apache to directly parse PHP, we have to do some configuration.
# vi/usr/local/apache2/conf/httpd.conf
In the httpd.conf file, add (the following two sentences should be added after the other AddType)
AddType application/x-httpd-php. php. phtml
AddType Application/x-httpd-php-source. Phps
Make sure that you have the following sentence in the file, without adding it to all loadmodule:
LoadModule Php5_module modules/libphp5.so
Add the index.php to the following DirectoryIndex back
DirectoryIndex index.php index.html Index.html.var
OK, in VI use ": Wq" to save the httpd.conf file, Exit VI.
8. Start Apache server:
#/usr/local/apache2/bin/apachectl Restart
Now Apache is able to run PHP, write a file test, in the/usr/local/apache2/htdocs directory, create a new phpinfo.php file,
There is only one line of code in the file:

Save this file, enter http://localhost/phpinfo.php in your browser, and you should see the system Information for PHP.
If an error occurs, such as prompting you to download phpinfo.php, then Apache is still unable to parse the php file, then please carefully check the above operation is correct.

Wu, Zendoptimizer
Go to the installation package directory: Cd/usr/local/software
1. # tar Xfz zendoptimizer-2.6.2-linux-glibc21-i386.tar.gz
2. # CD Zendoptimizer-2.6.2-linux-glibc21-i386
3, #./install.sh
4. Ask confirm the location of your php.ini file when entering/usr/local/lib/
Q Is you using Apache Web server? Select Yes

Six
1,./configure--prefix=/usr
2. Make
3. Make check
4. Make install



Start service configuration with System
If you want to run the HTTPD service when the computer starts, you can include these lines in the/etc/rc.d/rc.local file:
#start Apache
/usr/local/apache2/bin/apachectl start

If you cannot start, execute permissions for the appropriate startup script
Like Apache can't start chmod a=x apachectl


For later operation do not enter a path like/usr/local/apache2/bin, add the $path variable in the/etc/profile file
Add Apache, tomcat, and MySQL paths together.


Report:
First, the establishment of resin and Apache virtual host
For example, set up a tes1.jsp.com test2.jsp.com two virtual hosts

Vi/usr/java/httpd2/conf/httpd.conf
Copy the following into the httpd.conf.
Namevirtualhost 192.168.0.* Virtual Host building IP

directory where the documentroot/home/jsp1/files are located
ServerName tes1.jsp.com access to domain names

VirtualHost 192.168.1.*>
documentroot/home/jsp2/
ServerName test2.jsp.com

Vi/usr/java/resin/conf/resin.conf
Find the following code and modify:











Save from Kai Apache and resin
Tes1.jsp.com and tes2.jsp.com Virtual hosts can run the
Can do the following test http://localhost/caucho-status/
You can see that the test surface has
Virtual host:tes1.jsp.com:80
Virtual host:tes2.jsp.com:80
Prove that JSP virtual host is working properly
II. installation of Linux software
Linux packages found on the website or on a CD-ROM, common formats include rpm,deb,tar,gz,tgz,zip,bz2, and so on. We usually use the most is the RPM and tgz, according to statistics, the most popular online version should be changed to Redhat and Mandrake, and these two versions are in RPM package
, Tar is the most versatile package format, and almost every Linux software will provide a tar-formatted package, since this format is supported by any version of Linux, so you should at least understand how tar and RPM are used. As for the Deb can be converted to tgz or RPM using the Alien tool. BZ2 can be unpacked with BUNZIP2.
1. Installation of RPM files
RPM is an abbreviation for the Redhat Package Manager (Redhat Packages management tool), although the file format name is Redhat, but its original design concept is open and now includes Openlinux,mandrake and turbo Linux distributions, such as Linux, are accepted as industry standards.
RPM files are easiest to install on Linux systems. Take the famous image processing software XV as an example:
In terminal, the basic installation instructions are as follows:
Rpm-i xv-3.10a-13.i386.rpm
If your connection is fast enough, you can install the application directly from the network by simply adding the appropriate URL path to the software's file name:
Rpm-i ftp://ftp.trilon.com/pub/xv/xv-3.10a-13.i386.rpm
As a package management tool, RPM manages the data for all RPM program components that the system has installed. We can also use RPM to uninstall the relevant application.
RPM-E XV
Common parameters for RPM also include:
-VH: Display the installation progress;
-U: Upgrade package;
-QPL: Lists the file information in the RPM software package;
-QPI: Lists description information for RPM packages;
-QF: Find out which RPM package the specified file belongs to;
-va: Check all RPM packages to find the missing files;
More detailed parameters and their usage can be viewed in the RPM help documentation.
In X-window, the graphical installation and management of RPM files is more user friendly. After installing KPackage on KDE, installing RPM is just a mouse click, which is more convenient than Windows 98. But this must first install KDE.
I still introduce the more common method, still take the XV software as an example, after finding the xv-3.10a-13.i386.rpm file in the Linux file Manager, right-click on it, and in the pop-up menu, you can find three instructions for the RPM package: Show Info, Upgrade, Install.
After selecting "Show info", we will be able to see the Package Information window. The window is divided into three parts, the top shows the software name, size, creation and installation date and the developer's website and other relevant information, in the middle of the box is about the software overview, and the following shows the package contains all the files and their path information, It will tell you which files within the package will be installed in the system's directory,
The advantage of being aware of this information is that you can easily find the path to the startup program.
When you click on the "Install" or "Upgrade" button at the bottom, the installation or upgrade of the software will begin, and a window will appear prompting for the installation progress.
The RPM package has many advantages over other types of packages, but it does not mean that the RPM software installation is smooth. Common errors include the installation of an installed software, the software to be installed requires support for other software or system library files (which should be installed before the relevant software or system library files), and so on, similar to Windows.

2, the installation of tar
tar.gz, Tar. Z, tgz, bz2 and other file formats must first be decompressed to tar and then unpacked with tar to install. Examples of decompression and unpacking instructions are described below:
1. Solution Xv.tar.gz:tar ZXF xv.tar.gz
2. Solution Xv.tar.z:tar ZXF Xv.tar.z
3. Solution Xv.tgz:tar ZXF Xv.tgz
4. Solution Xv.bz2:bunzip2 xv.bz2
5. Solution Xv.tar:tar XF Xv.tar
A bunch of files that get unpacked will usually be stored in a directory. Depending on the software author, some of them will be compiled programs, and more is the need to compile their own source code. After entering the corresponding directory, using the "ls-f-color" instruction, the executable program will be marked with "*" bright green display, for the compiled program, directly type the command line with the path to run the program.
Recommended to read the document after the decompression, you should first use VI and other document editor to read the readme, install and other important related documents, here you will find the software detailed compilation steps and notes, you can understand the installation of the requirements, if necessary, you need to change the compilation configuration.
The source code of some packages can be uninstalled with the Make install command after compilation and installation, and if this feature is not provided, the uninstallation of the software must be manually removed. Since the software may be distributed across multiple directories in the system, it is often difficult to remove it cleanly, you should configure it before compiling, specifying that the software will be installed to the target path:./configure--prefix= directory name, so you can use "RM-RF Software directory Name" command to perform a clean and thorough uninstallation. Compared with other installation methods, it is most difficult for users to compile and install themselves, it is suitable for people who have some experience in Linux, and it is generally not recommended for beginners to use.
The usual compilation steps would be this:
./configure
Make
Make install (requires root to execute this command)
Uninstall available: Make uninstall or delete manually
Once compiled, the executable program of the software can be easily discovered in the current directory or in a subdirectory named SRC. At this point, the installation of the software will be over.

http://www.bkjia.com/PHPjc/317435.html www.bkjia.com true http://www.bkjia.com/PHPjc/317435.html techarticle need the Software as follows: apache:http://www.apache.org mysql:http://www.mysql.com php:http://www.php.net/downloads.php gd:http:/ /www.boutell.com/gd/#buildgd zendoptimizerhttp:// ...

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