Linux php+mysql+apache configuration process (pick) 1th/2 page _php Basics

Source: Internet
Author: User
Tags bz2 chmod gettext install php localhost mysql php and phpinfo unpack
The required software is 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
Zendoptimizer Http://www.zend.org/products/zend_optimizer
Gettext http://ftp.gnu.org/pub/gnu/gettext/
NETPBM http://sourceforge.net/projects/netpbm/
The version of the software 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

I. Installing MySQL mysql-standard-5.0.18-linux-i686.tar.gz
I downloaded all of him to the/usr/local/software directory.
Enter 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 decompression generates 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 the entry began to configure MySQL, the configuration process we want to give MySQL set a
installation directory, we set up under the/usr/local/mysql, think put the file in a place easier to manage, if you want to get more configuration information, use./configure--help:
Here I would like to emphasize that the default encoding of MySQL should be chosen at compile time, because GBK encoding is not supported in JSP when the default installation is not selected
So I compile it like this
Access to MySQL to a dedicated user, and must give the appropriate access rights, here we set root and MySQL have access to permissions.
7, we first set up a MySQL and MySQL users 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, after the establishment of the user we initialize the table (note: This step must be performed 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
And 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 files
13, [root@localhost mysql]# chgrp-r MySQL. #设定mysql组能够访问/usr/local/mysql
14, the setup is complete, basically installed, OK, we run our MySQL:
[Root@localhost mysql]#/usr/local/mysql/bin/mysqld_safe--user=mysql &
If there is no problem, a hint like this should appear:
[1] 42264
# starting Mysqld daemon with databases From/usr/local/mysql/var

Which proves that you've installed it successfully.
Use the following command to modify the root password, the default installation password is empty, in order to secure you must immediately modify
15,/usr/local/mysql/bin/mysqladmin-uroot Password xksoft321
The password that is now modified is: xksoft321
16. Set up automatic boot
CP support-files/mysql.server/etc/init.d/



Second, the installation of Apache
Enter 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 modules compiled into Apache:
#/usr/local/apache2/bin/httpd-l
Compiled-in Modules:
Http_core.c
Mod_so.c
See the above information indicates Apache support DSO mode. This can use the way of DSO to the PHP and resin modules added in.

Third, the installation of GD
Enter 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

Four, install PHP
Enter 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, to configure, this step is more critical, must be set up, especially to consider what you want to support, such as the GD Library, Xml,mysql and so on, if you want to know the detailed configuration, implementation./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 (Solve the PHP extension:mbstring problem)
If the above configuration is not wrong, then should eventually show thanks for the use of PHP, such as the words, then prove that the configuration is successful, if the above configuration options do not support, will prompt errors.
For example, you do not install MySQL, then--with-mysql can not use, so be sure to pay attention to the corresponding option system can support, if there is an error, then install the corresponding program, or remove the relevant options, configuration after the compile:
4, # Make
"Build complete" occurs after the compilation succeeds. Word, you can install it:
5, # Make install
6, after the installation of the php.ini-dist copy to/usr/local/lib/, and renamed to PHP.ini
# CP Php.ini-dist/usr/local/lib/php.ini
PHP is basically here to install successfully, if there is an error in the middle, in addition to the configuration when there is no selection options generally do not appear errors.
7, in order to enable 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 the following sentence is in the file and that you have not added it to yourself after all LoadModule:
LoadModule Php5_module modules/libphp5.so
Add index.php to the directoryindex behind the following
DirectoryIndex index.php index.html Index.html.var
OK, in VI use ": Wq" save httpd.conf file, Exit VI.
8. Launch Apache server:
#/usr/local/apache2/bin/apachectl Restart
Now Apache can 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 ();?>
To save this file and enter http://localhost/phpinfo.php in your browser, you should see the system Information for PHP.
If there are errors, 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.

Five, Zendoptimizer
Enter 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 to enter the/usr/local/lib/
Q Are you choose Yes when using Apache Web server?

Six
1./configure--PREFIX=/USR
2, make
3. Make check
4, make install



Boot 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 it does not start, please give the appropriate startup script permission to execute
Like Apache can't start chmod a=x apachectl


To not enter a path similar to/usr/local/apache2/bin in the future, add the $path variable in the/etc/profile file
Add the paths to Apache, Tomcat, and MySQL


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

Vi/usr/java/httpd2/conf/httpd.conf
Copy the following to httpd.conf.
Namevirtualhost 192.168.0.* Virtual host to build IP
<virtualhost 192.168.1.*>
directory where the documentroot/home/jsp1/file resides
ServerName tes1.jsp.com access to the domain name
</VirtualHost>
VirtualHost 192.168.1.*>
documentroot/home/jsp2/
ServerName test2.jsp.com
</VirtualHost>
Vi/usr/java/resin/conf/resin.conf
Look for 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 the Kai Apache and resin
The tes1.jsp.com and tes2.jsp.com virtual hosts can run
You can do the following test http://localhost/caucho-status/
You can see on the test surface there are
Virtual host:tes1.jsp.com:80
Virtual host:tes2.jsp.com:80
Proof JSP Virtual host works fine
Second, Linux Software Installation
The most common formats for Linux packages found on websites or on CD-ROMs include rpm,deb,tar,gz,tgz,zip,bz2 and so on. We usually use the most is probably the rpm and tgz, according to statistics, the most popular version on the Internet should be changed to Redhat and Mandrake, and these two versions are used in RPM package
, Tar is the most common package format, and almost every Linux software will provide a package in the format of tar, because this format package is supported by any version of Linux, so you should at least know how to use tar and RPM. As for Deb, use the Alien tool to convert to tgz or RPM. BZ2 can be bunzip2 unpack.
1, the installation of RPM files
RPM is an abbreviation for Redhat Package Manager (Redhat Package management tool), a file format name that, although marked with a Redhat logo, is open in its original design concept and now includes Openlinux,mandrake and turbo Linux, such as Linux distribution versions are adopted, can be regarded as a recognized industry standards.
RPM files are the easiest to install in a Linux system. 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 network speed is fast enough, you can also install the application software directly from the network, just add the appropriate URL path before the filename of the software:
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 the RPM program components that are installed on the system. We can also use RPM to uninstall the relevant applications.
RPM-E XV
The common parameters of RPM include:
-VH: Show installation progress;
-U: Upgrade package;
-QPL: List the file information in the RPM software package;
-QPI: Lists the description information of the RPM package;
-QF: Find which rpm software package the specified file belongs to;
-va: Check all RPM software packages to find 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 friendly to users. After installing the KPackage first on KDE, installing RPM is just a click of the mouse, which is more convenient than Windows 98. But this must first install KDE.
I would like to introduce a more commonly used method, still take the XV software as an example, in the Linux File Manager found xv-3.10a-13.i386.rpm file, right-click it, in the pop-up menu can be found specifically for the RPM package of three instructions: show Info, Upgrade, Install.
After you select Show Info, we will see the Package Information window as shown in the figure. The window is divided into three parts, the top display is the software name, size, date of creation and installation, as well as the developer Web site and other related information; In the middle box, it is an overview of the software, and the following shows all the files and their path information contained within the package. It will tell you which directories within the package will be installed in the system,
The advantage of paying attention to this information is that you can easily find the path to the startup program.
When you click on the bottom of the "Install" or "Upgrade" button, you will start to install or upgrade the software, there will also be a pop-up prompts to install the progress of the window.
The RPM package has many advantages over other types of packages, but it's not that the RPM software installation is smooth sailing. Common errors include * * * * * Install a software that has already been installed, the software you want to install requires additional software or system library files (you should install these software or system library files first), and so on, which is similar to Windows.

2, the installation of tar
tar.gz, Tar. Z, tgz, bz2 and other file formats to extract the tar before using tar to unpack the installation. Examples of decompression and packet-solving instructions are as follows:
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 you get after you unpack them are usually stored in a directory. Depending on the authors of the software, some will be compiled programs, and more is the need to compile their own source code. After entering the appropriate directory, using the "ls-f-color" instruction, the executable program will be marked with "*" bright green display, for the compiled program, directly type with the path of the command line to run the program.
It is recommended to read the documentation before decompression, should use VI and other instrument editor to read the software directory, such as the Readme, install and other important related documents, where you will find software detailed compilation steps and considerations, you can understand the installation of what needs, when necessary to change the compilation configuration.
The source code for some packages can be uninstalled with the make install command after compiling the installation, and if this feature is not available, the uninstall of the software must be manually removed. Since software may be able to distribute files across multiple directories of the system, it is often difficult to remove them cleanly, then you should configure them before compiling to specify that the software will be installed to the target path:./configure--prefix= directory name, so you can use the RM-RF software directory name command to perform a clean and thorough uninstall. Compared with other installation methods, users need to compile their own installation is the most difficult, it is suitable for the use of Linux has a certain experience of people, generally do not recommend the use of beginners.
The usual compilation steps would be this:
./configure
Make
Make install (requires root to be able to execute this instruction)
Uninstall available: Make uninstall or manually delete
After the compilation is complete, the executable program of the software can easily be found in the current directory or in a subdirectory named SRC. At this point, the installation of the software will be over.
Current 1/2 page 12 Next read the full text
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.