Apache + MySQL + PHP for Linux Raiders

xiaoxiao2021-03-06  57

Authors: from: Linux knowledge base http://www.douzhe.com/docs/linux/Contact: Unknown download MySQL, php, apache package to set up such a master suite which need it? Not: apache, mysql and php! Apache: The current Apache has already been out of version, but the most widely used or a 1.3.x version, this version is currently available to the latest version 1.3.20, you can take a look at the Apache home page to see related information: Apache Home (English): Apache Kit (Download by Homepage): PHP: The latest version is version 4.0.6 (喔 喔 in June 2001), you can go to PHP's primary page to see some related 咚咚Oh! PHP Homepage (English): PHP Home Download: mysql: The latest version is 3.23.41, the same, you can also take a look at the mysql official website! Mysql Homepage (English): MySQL Home Download: That is, there are three files, namely: apache-1.3.20.tar.gz php-4.0.6.tar.gz mysql-3.23.41.tar. GZ Install Mysql, PHP and Apache installed these three kits need to be careful, because use RPM upgrade, there may be no way to get the latest suite version, so we use the most original original code upgrade method. The installation method is as follows: Remove the old version and decompression: remove the relevant old version of the information, if you are redhat 6.1, then the following suite you can remove! [root @ tsai / root] # rpm -e mod_perl [root @ Tsai / root] # rpm -e phpfi [root @ Tsai / root] # rpm -e apache is of course, if you have previously installed the old version of Apache, PHP, Or mySQL, then you can also remove it. In fact, this is a personal habit, some people like to save two versions in their system, if you want to install two versions in your system, then you don't need to remove the RPM installation kit! However, in order to be afraid of system conflicts, you have to cancel HTTPD, PHP and MYSQL service in a setup program! Unzip: If you place apache, mysql, and php three files in / home / test, you must decompress the data to / usr / local, you can do this, you can: [Root @ Tsai / root] # CD / usr / local [root @ Tsai local] # tar -zxvf /Home/test/apache_1.3.20.tar.gz [root @ Tsai local] # tar -zxvf /Home/test/mysql-3.23.41.tar .gz [root @ Tsai local] # tar -zxvf / home / test / tar -zxvf /test/php-4.0.6.tar.gz The three directories will be 3 in / usr / local, respectively: Apache_1 .3.20, Mysql-3.23.41, PHP-4.0.6.

Install MySQL Kit: If you are in English, you can go to the /usr/local/mysql-3.23.41 this directory to look at the INSTALL-SOURCE file, which is a detailed description of how to install your Mysql. If you have to work according to my steps, please look down! [root @ TSAI / ROOT] # cd/usr/local/mysql-3.23.41 [root@tsaimysql-3.23.41] #. / configure --prefix = / usr / local / mysql --localstatedir = / usr / local / MySQL / VAR Top this steps in checking your system to set the information that suits your system! Among them, --prefix picks up the mysql directory you want to install, and back is the place you want to place the database, usually we will set it in Var. [root @ Tsai MySQL-3.23.41] # make [root @ Tsai MySQL-3.23.41] # Make Install The top Two steps are installed in install MySQL to the / usr / local / mysql path you just set. Pay attention to, the above steps can take a long time to take your CPU! [root @ TSAI mysql-3.23.41] # ./scripts/mysql_install_db If you have already installed MySQL, this step is not installed, this step is generating a GRANT TABLES! That is, the database! This step is very important. If there is no such step, your mysql will not move! [root @ tsai mysql] # adduser mysql [root @ Tsai mysql] # chown -r mysql: mysql / usr / local / mysql above this step in generating mysql account and group name, additional / usr / local / mysql This just installed 咚咚 specified for all of MySQL, this is for security considerations, because MySQL account is different from your original Linux account! [root @ tsai mysql] # CD / usr / local / mysql / share / mysql [root @ Tsai mysql] # chmod 777 mysql.server Top this step below this step, then activate your mysql's execution unit, set Everyone can use the format.

[root @ tsai mysql] # / usr / local / mysql / bin / safe_mysqld --user = mysql & above this line is in MySQL service! [root @ Tsai MySQL] # / usr / local / mysql / bin / mysqladmin -u root password abcde top this line on this line in the MYSQL password of the root, where the abcde is a password, you can set it! This is installed in this way! Start tested your mysql! Increase the PHP module: Basically, PHP can be considered a module of Apache, because it is a module belonging to Apache, so we must first set a Configure setting detection for Apache, so that PHP can be added to apache, detailed steps As follows: [Root @ Tsai / root] # cd/usr/local/apache_1.3.20 [root @ Tsai Apache_1.3.20] # ./configure --prefix = / usr / local / apache The above instruction is to install Apache / usr / local / apache meaning, please note that you must first confirm the Apache to detect once to install PHP! [root @ TSAI Apache_1.3.20] # CD /usR/local/php-4.0.6 [root @ Tsai PHP-4.0.6] # ./configure --with-apache = / usr / local / apache_1.3.20> - -with-mysql = / usr / local / mysql> --enable-track-vars Please pay attention to the above instructions, and after the three lines of the middle, you will pick a symbol, which is the meaning of the instruction, that is, in fact The last four lines will be regarded as the order of the same line! You can also write the above instructions to a long string. In addition, what should be noted that apache needs to point to the directory that just detects, and MySQL points to the directory already installed! Don't get wrong! [root @ TSAI PHP-4.0.6] # make [root @ Tsai PHP-4.0.6] # make install Start installing! After installation, you will have a PHP4 subdirectory in /usr/local/apache_1.3.20/src/modules, there is a main link library of PHP4! [root @ TSAI PHP-4.0.6] # cp /usr/local/php-4.0.6/php.ini-dist /usr/local/lib/php.ini will set the main PHP setting file php.ini-dist Copy the file /usr/local/lib/php.ini This file is because Apache or other programs need to be used to use this file when performing PHP, if you are familiar with PHP, you can modify / usr /LOCAL/LIB/PHP.INI This file is in line with your settings.

This is installed in the PHP kit! Install Apache Kit: Come back, you start to install Apache! Since PHP has been installed, there is a directory of PHP4 in /usr/local/apache_1.3.20/src/modules! [root @ TSAI / ROOT] # CD /usR/local/apache_1.3.20 [root @ Tsai Apache_1.3.20] # ./configure --prefix = / usr / local / apache> - Activate-module = src / modules / PHP4 / LIBPHP4.A The above two lines are the same line, pay attention to - the activate-module, this is installed first to use this module! [root @ Tsai Apache_1.3.20] # make; make install this is installed! Start setting WWW and test-related modules! Simple setting Apache To activate Apache, in this version (1.3.20), there is only one parameter setting file "httpd.conf" file. If you are using redhat6.1 original Apache, there are three files, namely httpd.conf access.conf srm.conf will not explain the apache_1.3.20 version, if you are installed with an old version, please in other Find related settings in both files! Apache's main catalog: This is a very important place, because different versions of redhat and different installation methods will produce a lot of catalog type, the following use by redhat6.1, redhat7.0 cle0.9, And use the original code to install 1.3.20 directory: Redhat 6.1: If you use the original Apache 1.3.9, your parameter setting file will place in / etc / httpd / confation, and the host's web page is placed on / HOME / HTTPD / HTML, as for CGI, it is placed in / home / httpd / cgi-bin; redhat7.0 cle 0.9: The same, this system is preset Apache parameter file, placed in / etc / In httpd / confation, the host web page is moved to / var / www / html, and the CGI-BIN is placed in / var / www / cgi-bin; the original code installation: If the original code is installed, the preset path will be used When setting in / usr / local / apache, your parameter setting file will be in / usr / local / apache / confal, and the more larger is the placement directory of the host web page, changed to / usr / local / apache / In the catalog of HTDOCS, as for CGI is also placed in / usr / local / apache / cgi-bin. The Apache setting will be introduced under the files generated by the original code installation.

Basic setting: 1. Activate Apache service: Basically, as long as you activate Apache, you should see your host-preset webpage on the client's browser program! The way to activate is: [root @Tsai / root] # / usr / local / apache / bin / apachectl start <= activation At the same time, ApachectL has other parameters as follows: Apachectl Stop: Stop WWW service; Apachectl Restart: Reactive Www service, this instruction is used to reactivate it after you modify the parameters of Apache. Apachectl Status: Detects the status of the WWW. 2. Change the Chinese Home: Due to the original setting of the WWW, specify your home name as index.html or index.htm, however, this version of the home page supports more language, so you must modify the home file name : [Root @Tsai / root] # cd / usr / local / apache / htdocs / in setting up your home page You can write to Win98 with Dreamweaver write index.html to transfer to the top of Linux, now you should be Connect in other client machines! You can now turn on the IE or other browser, then you can enter your DNS name (if any) on your website, or your IP number, you can see the homepage of your own host! 3. Set user rights: Since you are installing Apache in root, if you can't connect to your host's homepage, it is possible that the WWW home placement may have permission, you need to set Where the permission is / usr / local / apache / htdocs and / usr / local / apache / cgi-bin, you can set: [Root @Tsai Apache] # chmod 755 / usr / local / apache / CGI-bin [root @Tsai Apache] # chmod 755 / usr / local / apache / htdocs You can also set the permissions of 744! 4. Set the auto execution: In addition, in order to let your WWW and mysql service can be turned on, you can write the scripts that are activated in the following two lines in your /etc/rc.d/rc.local's last : [Root @Tsai / root] # vi /etc/rc.d/rc.local / usr / local / apache / bin / apachectl start /usr/local/mysql/share/mysql/mysql.server Start, Every time you boot, Linux will automatically perform Apache and MySQL! Start setting httpd.conf profile: After saying some Laramis, finally want to actually set httpd.conf this file, please edit it with VI.

[root @Tsai / root] # CD / usr / local / apache / conf [root @Tsai conf] # vi httpd.conf1. Basic environment setting: The following is the meaning of the options in httpd.conf: Servertype Standalone is set to activate the status of the Apache, if it is STANDALONE to execute, usually we all choose Standalone (default), but if you choose: Servertype inetd: The service using the Internet is used online. ! Serverroot "/ usr / local / apache" indicates that the local directory where the Apache is located. Timeout 300 is used to set the client that connects to your host. When more than 300 seconds, there is no way to connect your host, it will be Disconnect processing! MinSpareServers 5 <= If a small station or a general small personal website, it can be changed to 3 MaxSpareServers 10 <= If a small station or a general small personal website, it can be changed to 5 StartServers 5 MaxClients 150 <= if a small station or a general small person The website can be changed to the top of 100 is where the httpd service number is turned on. After you perform httpd, execute ps -aux | grep httpd under the shell, you can see the number of httpds, usually this is related to your RAM, If it is a small station, you can set a little bit, such as the minimum set 3 maximum 5! And StartServers set the same as MIN! As for MaxClients, you can set a little bit, because it is too much consuming system resources, and it is too small to make many people come up! Therefore,, for example, 100 can be set.

Port 80 This thing is trying to move as much as possible, because the WWW service preset communication port (port) is 80 unless you have to make a website (internal website), User Nobody Group Nobody will preset Apache to Nobody this People and groups! Feeling all people can use serveadmin frame@mail.uc88.domain this is the httpd administrator account setting your machine! Set into your account! ServerName http://www.uc88.domain/ This is your host name, first take the previous annotation symbol! Please set it. If you don't have a host name, choose Localhost! Bindaddress * This is an item used to allow your WWW to accept virtual IP machines. For example, your virtual domain is 192.168.1.0, it can be changed to 192.168.1.0! Usually if you want to accept the virtual IP, you will play directly! 2. Path settings: The following parameters are in setting each web page or the path to the service! (Old Edition in Access.conf) DocumentRoot "/ usr / local / apache / htdocs" above this on the main home page of the host, because we set the host name: http://www.uc88.domain/ When others are http: //www.uc88.domain, the system will pass the home page of the / usr / local / apache / htdocs in the path! You can also change this path yourself! Options Indexes ExecCGI FollowSymLinks MultiViews AllowOverride None Order allow, deny Allow from all The above things show the WWW can be carried out in the host main page directory is placed! Options works for web pages, you can check, have the following items: execcgi: indicates that you can execute the CGI program in this directory; FOLLOWSYMLINKS: indicates that you can connect to him; multiviews: indicates that you can perform an animation, music and other items ALLOWOVERRIDE NONE indicates that anyone can read information; as for the Allow from ALL indicates that your host accepts any location source connection.

UserDir public_html The above option needs to be turned on, so your user account can be home! And your user's homepage is placed under / home / user / public_html, you can change public_html to www, then the user's homepage needs to be placed in / home / user / www, if the above setting is used as an example My homepage needs to be placed under / home / frank / public_html! DirectoryIndex index.html index.htm index.php This is used to explain the file name of the home page, usually the default is index.html, but some web editors are index. HTM, so you can add a few file names, so, your homepage can support multiple files! It is best to use the default value! 3. Turn on PHP and other modules: Since we need to support the Apache of the PHP module, you need to open this module! AddType Application / X-httpd-php .php address / x-httpd-php-source .phps cancels the two modules of the annotation of the two modules, please note that this is the PHP4 module, do not mix with the PHP3 module! Because we are in the installation of the PHP4 version! AddHandler CGI-script .cgi's annotation can also take it, so that the client can use the CGI program! 4. Open Apache Status: We can view the host's Apache execution through the IE, if you need this service, you will cancel the following annotation: setHandler Server-Status Order Deny, Allow Deny from all allow from .your_domain.com setHandler Server-Info Order Deny, Allow Deny from all allow from .your_domain.com will be above .your_domain. COM changes into your DNS, for example, I can change it into .uc88.domain! In this way, only UC88.DOMAIN machine can see your Apache execution status! How to watch, take me as an example, just enter http://www.uc88.doamin/server-status http://www.uc88.domain/server-info from UC88.DOMAIN in UC88.DOMAIN My host status! 5. Reactivate: Just down / usr / local / apache / bin / apachectl restart can execute httpd! If you are here, you will have your IE to see your network! (If there is a problem, please reactivate Linux!) Test the mysql and PHP kits to test the two kits before determining Mysql and Apache have been activated!

OK, come to test! PHP test: You can edit a file, the file name can be Test.php, then place this file in / usr / local / apache / htdocs (that is, your host's web page!) [Root @Tsai / root] # vi /usr/local/apache/htdocs/test.php Then connect your host, take me as an example, I will enter http://www.uc88.domain/test. PHP can see your PHP state! That is, your PHP can be implemented! MySQL test: Similarly, MySQL is also editing a file, doing see if you can: [root @Tsai / root] # vi /us/local/apache/htdocs/mysqltest.html

Host User Password
then execute http: // www. UC88.domain / mysqltest.html know if your mysql can be executed! Write the first personal home page If your website supports the user to place a personal page, where is your personal page? Just mentioned in the setting of httpd.conf, there is a setting of the personal home page, usually if you don't set an httpd.conf file, his default value is public_html, ok, how to set What about personal web? Suppose it takes this account as an example, we can do this: [frank @frank frank] $ mkdir public_html [frank @frank frank] $ chmod 755 public_html [frank @

转载请注明原文地址:https://www.9cbs.com/read-113413.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.043, SQL: 9