Linux under Php+mysql+apache configuration method

Source: Internet
Author: User
Tags bz2 chmod gettext phpinfo to domain

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, [[email protected] software]# chmod 755 mysql-standard-5.0.18-linux-i686.tar.gz
2, [[email protected] 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, [[email protected] 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:
[Email protected] mysql-standard-5.0.18-linux-i686]# groupadd MySQL #建立mysql组
8, [[email protected] 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)
[Email protected] mysql-standard-5.0.18-linux-i686]#/scripts/mysql_install_db--user=mysql
#初试化表并且规定用mysql用户来访问初始化表以后就开始给mysql和root用户设定访问权限,;
10, [[email protected] 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, [[email protected] mysql]# chown-r root. #设定root能访问/usr/local/mysql
12, [[email protected] mysql]# chown-r mysql data #设定mysql用户能访问/usr/local/mysql/data, there is a MySQL database file
13, [[email protected] mysql]# chgrp-r MySQL. #设定mysql组能够访问/usr/local/mysql
14, the setup is finished, basically installed, well, we run our MySQL:
[Email protected] 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 c-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 Cwith-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 Cwith-gettext=/usr/local/gettext
Ddenable-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:
<? Phpinfo ();?>
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
<virtualhost 192.168.1.*>
directory where the documentroot/home/jsp1/files are located
ServerName tes1.jsp.com access to domain names
</VirtualHost>
VirtualHost 192.168.1.*>
documentroot/home/jsp2/
ServerName test2.jsp.com
</VirtualHost>
Vi/usr/java/resin/conf/resin.conf
Find the following code and modify:
<!--
-Configures an explicit root web-app matching the
-WebApp ' s ROOT
-
<web-app id= '/' document-directory= '/usr/java/httpd2/htdocs '/>
<web-app id= '/' document-directory= '/home/jsp1 '/>
<web-app id= '/' document-directory= '/home/jsp2 '/>
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

Linux under Php+mysql+apache configuration method

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.