Build a LAMP environment 4-Integration

Source: Internet
Author: User

Build a LAMP environment 4-Integration

It is really tiring to reorganize previous notes and send them to a blog. The previous notes are messy and the knowledge points are also complicated. Every time you find that there are similar content in other places, you have to re-Modify the blog, the previous sections are relatively basic and will be explained later with some advanced functions.
1. Configure apache with php1, # vim/usr/local/apache2/conf/httpd. conf: AddType application/x-gzip. gz. add AddType application/x-httpd-php under this line by tgz. php

2. Find:  DirectoryIndex index.html Change this row:  DirectoryIndex index.html index.htm index. php 3. Modify ServerName www.example.com: 80 to ServerName localhost: 804. If this parameter is not set, the error 403 is returned.  # Versions earlier than 2.4 # Deny from all => Allow from all #2.4 and later Require all denied => Require all granted 
2. test whether php is correctly loaded, whether mysql1 can be correctly connected, and whether apache can be properly integrated with php # vim/usr/local/apache2/htdocs/test. php # Open it in a browser to see if "Hello world" is output. ", or directly use curl to test # curl 127.0.0.1/test. phpHello world.2. Add the password to the root account before testing the connection to mysql. Here we will explain how to change the root password (-p should not be followed by a space; otherwise, an error will occur !) #1. root has no password and needs to be changed to 123456: # mysqladmin-uroot password 123456 #2. root has a password (123456). Enter the old password mysqladmin-u root-p password 654321 #3. root has a password (123456), and you do not need to enter the old password: mysqladmin-u root-p123456 password 6543213 to test whether php can connect to mysql # vim/usr/local/apache2/htdocs/test_mysql.php 
3. php cannot parse and handle the problem properly. 1. Check the configuration file httpd. in conf: AddType application/x-httpd-php. php # Is there an error in this line (that is, the above header configuration added)? 2. Check whether the php5_module module is loaded in apachectl-M. If not, check httpd. whether to enable this module in the conf configuration file (with '#' in front, it indicates that the module has been commented out and needs to be removed ): loadModule php5_module modules/libphp5.so #2. ldd: Check whether all the shared libraries required by libphp5.so exist. If not, manually copy the dependent shared libraries to/lib, the following shows how to use ldd (see the image): ldd/usr/local/apache2/modules/libphp5.so

No. If the required shared library cannot be found, the not found will appear. In this case, you only need to copy the shared library to/lib:

This error occurs because mv and copy also depend on/lib/libselinux. so.1 shared library, so it's miserable... fortunately, you can use ln to make a hard connection to/lib (this also indicates that ln does not depend on the shared library) # ln libselinux. so.1/lib/libselinux. so.1

3, here a ln, cp, mv are dependent on the shared library:/lib/ld-linux.so.2 (in fact many commands such as rename, dd, echo, etc. are dependent on the Library) if you use this library for experiments, the consequences will be a little serious. This means you cannot rename music videos, rename them, copy them, or even link them, in this case, how can I move the database to the original location? (Of course, this is not as serious as the 'rm-rf/'command, but it can still be repaired through third-party software and many other methods.)-linux allows you to operate at will and also allows you to commit suicide.
Iv. Stress Testing # apache has an AB: ApacheBench tool under/usr/local/apache2/bin/for web performance stress testing. # The AB command is not only used to test apache, it can also be used to test any website, such as nginx and IIS. 1. Common options: -c Number of requests initiated at a time-n total number of requests initiated -- help view help information 2. Test and Test Methods Group 1: Send 10 requests each time for a total of 100 requests, test Static Page, php, php + mysql AB-c 10-n 100 localhost/test.html # request static page AB-c 10-n 100 localhost/test. php # request dynamic page AB-c 10-n 100 localhost/test_mysql.php # request php to combine with mysql page group 2: Increase the test data AB-c 100-n 1000 localhost/test. Htmlab-c 100-n 1000 localhost/test. phpab-c 100-n 1000 localhost/test -- mysql. group 3 of php: Continue to increase the test data (according to your server quality decision, do not increase the size of the ordinary PC, it will be bad to crash later) AB-c 2000-n 10000 localhost/test.html # An error may be reported here # by default, centos allows up to 1024 files to be opened by each process, you can use "ulimit-n 3000" to change the limit to 3000 so that there will be no errors. 3. Try to find other machines in the LAN to help with the test during the test. This is the most accurate; the test on the local machine is not very effective. After all, you have to send the request message and Response Message by yourself at this time. Of course, it is not so accurate. If you use a remote server, you need to go through the router and DNS resolution, the tested time also requires a delay time, which is generally the least accurate (think about this time your network is not good, but also choose big data testing, this time the end Will the displayed time be accurate? Most of the time is spent in the network transmission process. 4. Here we will not explain the result displayed by the AB command. The following link has been summarized as follows:

See: http://www.ha97.com/4617.html

Next I will introduce some advanced LAMP functions, such as anti-leech log segmentation static File Cache configuration Access Control URL rewriting domain name jump configuration access log... apache2.2 and 2.4 (such as Access Control) are compared.

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.