Home  >  Article  >  Backend Development  >  I troubled you two a lot in the past two days. Now that the upgrade work of the Linux server has been completed, I will share the compiled upgraded documents with you_PHP Tutorial

I troubled you two a lot in the past two days. Now that the upgrade work of the Linux server has been completed, I will share the compiled upgraded documents with you_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:28:13714browse

Linux server upgrade steps 1. Detect the installation mode of MySQL, Apache, and PHP: The main purpose of this part is to understand the installation mode of MySQL, Apache, and PHP, so as to choose how to delete the previous old version. 1. MySQL: # rpm –q mysql package mysql is not installed. The displayed results show that MySQL is not installed as an RPM package, but as a binary package. 2. Apache: # rpm –q apache apache-1.3.12-2 The displayed results show that Apache is installed as an RPM package and the version is 1.3.12-2. 3. PHP: # rpm –q php php-3.0.15-2 The displayed results show that PHP is installed as an RPM package and the version is 3.0.15-2. two. Back up files on Linux server: 1. MySQL: Export library file, export all previous libraries in MySQL. 2. PHP3: Back up the PHP source files. 3. Apache: This time due to a problem with the Linux version, the new version of Apache, whether it is RPM (Redhat Package Management) or binary package, cannot be installed successfully. Apache has not been upgraded, but its key httpd.conf file has been modified (this part will be described in detail later). three. Delete the old version of MySQL and PHP: Choose different deletion methods according to the installation mode detected in "2". 1. MySQL: It has been detected that the binary package is used to install and uninstall. First use the "find –name" command to find the paths of all MySQL files, and then use the "rm –rf file path" command to delete them one by one. 2. Apache: As mentioned earlier, Apache has not been upgraded due to problems with the Linux version. 3. PHP: Since it has been detected in "Two" that PHP3 is installed in RPM, you only need to run: # rpm –e php-3.0.15-2 error: removing these packages would break dependencies: php is needed by php -imap-3.0.15-2 php is needed by php-ldap-3.0.15-2 php is needed by php-pqsql-3.0.15-2 php is needed by piranha-qui-0.4.12-1 After running, Displays the errors listed above. Solution: First use the find command to find the path of each package shown above, then delete them one by one and run the command again. Of course, you can also use the rpm command to delete these files one by one. #rm –rf package path 4. Install the new version: The new versions of MySQL and PHP are all placed in the tar packages of mysql-3.23.46.tar.gz and php-4.0.6.tar.gz in the "/root" directory. 1. MySQL: (1) # cd /root Enter the root directory. (2) # tar –zxvf mysql-3.23.46.tar.gz Unpack the tar package of the new version of mysql that was previously placed in the root directory. (3) # cd mysql-3.23.46 Enter the directory of mysql after unpacking. (4) # ./configure –prefix=/usr/local/mysql >--with-berkeley-db=./bdb >--with-tcp-port=3306 >--with-mysqld-user=mysql >- -with-charset=gb2312 >--with-extra-charset=latinl Configure mysql: ①Installation path; ②Support bdb database type, transaction processing; ③Set port to 3306; (Pay attention to this part, if this is not written during configuration Configuration statement, or written as 9999, will cause MySQL to be unable to enter normally) ④Set the user; (5) # make compile. (6) # make install installation. (7) # scripts/mysql_install_db Establish initial database (8) # chown –R root /usr/local/mysql # chown –R mysql /usr/local/mysql Set permissions (9) # adduser mysql Add mysql user (10) # cd /etc/rc.d/init.d # cp /root/mysql-3.23.46/support-files/mysql.server mysql # chmod +x mysql Increase execution permissions (11) # /sbin/chkconfig –del mysql # /sbin/chkconfig –add mysql Run chkconfig and add mysql to the system’s startup service group (12) # reboot Restart the Linux server (13) # cd /usr/local/mysql/bin #./mysql Enter MySQL ( 14) mysql>show databases; +----------+ | Database | +----------+ | mysql | | test | +---------- -+ 2 rows in set (0.11 sec) Display the libraries existing in MySQL (15) mysql>use mysql Enter the library named mysql (16) mysql>grant all on *.* to admin@'%' identified by '422817 '; Set user and password (17) mysql>quit Bye Exit MySQL (18) # ./mysql –u root admin –p Enter password: Try to enter MySQL according to the user and password just set. At this point, MySQL installation and testing are successful. The next step is to import the library file backed up before. MySQL-Front is also used. However, one thing to note is that when importing the previous library file, you must first create the database, and it must have the same name as before. 2. Apache: Although the entire Linux server has been upgraded this time, the final result is that Apache still uses the original version. But here, let me mention the installation process of Apache as RPM package: First find the previous CD of Linux 6.02. In the "RedHat/RPM" directory, there is a file named apache-1.3.12-2.i386.rpm file. Since the Linux server does not have a CDROM, the method is the same as mentioned above. Now copy the files in this directory under Windows, and then copy them to the directory where Samba is enabled through the LAN. (1) # cp /home/httpd/html/pos/bak/apache-1.3.12-2.i386.rpm /root Copy the RPM package files to the directory "/root" (2) # cd root Enter root Directory (3) # rpm –i apache-1.3.12-2.i386.rpm Install the apache-1.3.12-2.i386.rpm package to the Linux server. The default installation path is: ./usr/lib/ apache, if it is a binary package, the path should be: /usr/local/apache. (4) # /etc/rc.d/init.d/httpd start Run Apache.If the result is as follows, it means that it can be started normally. Starting httpd: OK ] (5) # ps aux | grep httpd Query all programs in the entire system that include httpd (Apache server) and are executing. root 1368 0.0 3.4 4560 2196 ? S 16:31 0:00 httpd nobody 1371 0.0 3.6 4668 2280 ? S 16:31 0:00 httpd nobody 1372 0.0 3.6 4668 2280 ? S 16:31 0:00 httpd nobody 1 373 0.0 3.6 4668 2280 ? S 16:31 0:00 httpd …… (6) If Apache is running normally, you can browse to the Apache welcome page from IE on other machines. At this point, Apache Web Server is installed and tested successfully. 3. PHP: (1) # /etc/rc.d/init.d/httpd stop First stop Apache (2) # cd /root to enter the root directory. (3) # tar –zxvf php-4.0.6.tar.gz Unpack the PHP4 tar package previously placed in the root directory. (4) # cd php-4.0.6 Enter the directory of PHP4 after unpacking. (5) # ./configure –apxs=/usr/sbin/apxs >--with-config-file-path=/etc/httpd/conf >--with-mysql=/usr/local/mysql >--with -gd >--with-zlib >--with-system-regex >--enable-ftp Configure PHP: ① If apxs is installed to another path, you must change "/usr/sbin/apxs" to point to the apxs script program The path where it is located. Usually for binary packages, the path is "/usr/local/apache/bin/apxs"; for RPM packages, the path is "/usr/sbin/apxs". ② Configure PHP as Apache's DSO module. The configuration file will be saved in "/etc/httpd/conf" (together with the Apache configuration file); ③ If MySQL is installed as an RPM package, you should change "--with-mysql=/usr/local/mysql" to " --with-mysql" ④ If there is no GD library, please cancel "--with-gd" ⑤ If you want to support the ftp upload function, you need "--enable-ftp" (6) # make compile. (7) # make install installation. (8) # reboot Restart the Faresever server 5. Configuration: This part of the configuration is mainly for Apache's httpd.conf file. We require that Apache, which has not been upgraded before, can parse both PHP4 and PHP4. Since the Apache server of the Linux server is packaged in RPM, the httpd.conf file is placed in "/etc/httpd/conf/httpd.conf". The following are the editing changes made to the configuration file: 1. Find # LoadModule php3_module modules/libphp3.so in the file and change it to: # LoadModule php4_module /usr/lib/apache/libphp4.so Function: Change the PHP3 Module previously loaded by Apache to the PHP4 Module, followed by The path of the Module file. 2. Find the file] # AddModule mod_php3.c Change it to: # AddModule mod_php4.c Function: Change the Module previously added by Apache from PHP3 to PHP4. 3. Find the file: Port 80, where it is located, and add the following statement below: DirectoryIndex index.html index.shtml index.cgi index.phtml index.php3 index.php AddType application/x-httpd-php .php3 AddType application/x -httpd-php .php AddType application/x-httpd-php-source .phps Function: It can be an unupgraded Apache, which can parse both PHP3 and PHP4. At this point, the Apache configuration file "/etc/httpd/conf/httpd.conf" of version 1.3.12 has been modified. six. Possible errors during installation: 1. MySQL: (1) If the MySQL installation proceeds to the previous step (13), an error occurs and cannot be entered normally. Reason for the error: The port setting is incorrect. Use the "netstat -t -l -p" command to check the network status and find that there is no mysql at all and only port 9999 is running. Modification method: ① Check /usr/local/mysql/bin/safe_mysqld to see if there is a line MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-9999}, change it to MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-3306} ② Use VI editor to enter and view. and modify. # vi /usr/local/mysql/bin/safe_mysqld ③ Restart mysql # /etc/rc.d/init.d/mysql.server stop # /etc/rc.d/init.d/mysql.server start (2) There is an error connecting to MySQL. Just change the opendatabase.php file to 127.0.0.1 and you can connect normally. Reason for the error: permission issue. Modification method: Delete a record in the user table of the mysql library where the Host is fareserve.fareexpress.com and the User is empty. 2. Apache: I wanted to install a new version, namely Apache 1.3.22, but neither the RPM package nor the binary package could be installed successfully. Considered to be due to the Linux version. In the end, I still used the previous version of Apache and installed it with the RPM package, without any problems. 3. PHP: Installation went smoothly. It’s just that after installation, FareExpress (PHP3) and Power POS Management (PHP4) cannot be browsed in IE. Later, Apache’s httpd.conf (configuration file) was modified, which has been introduced in the fifth point “Configuration”. It is clear that I will not repeat the introduction here.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531803.htmlTechArticleLinux server upgrade step 1. Detect the installation mode of MySQL, Apache, and PHP: The main purpose of this part is to understand the installation mode of MySQL, Apache, and PHP, so as to choose how to delete...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn