Install and configure the Apache + PHP + mysql + phpMyAdmin source package in linux

Source: Internet
Author: User


Linux Apache + PHP + mysql + phpMyAdmin source package installation configuration, install Apache2.2.221, to the official website to download http://httpd.apache.org/download.cgi 2, unzip www.2cto.com tar-zxvf httpd-2.2.22.tar.gz3, create the target folder (pay attention to all the following operations are executed under the root user) mkdir/usr/local/apache2 that is to say, the installed apache2 must be installed in this folder. 4. The configuration is returned to the folder generated after decompression. /configure -- prefix =/usr/local/apache -- enable-module = shared must add the following parameters; otherwise, php cannot be used, -enable-module = shared indicates that Apache can dynamically load modules. 5. Compile make 6 and install make install. 7. Start, restart, and stop. Switch to the directory/usr/local/apache2/bin after installation. /apachectl-k start. /apachectl-k restart. /apachectl-k stop 8. Edit the configuration file/usr/local/apache2/conf/httpd. find the conf file www.2cto.com AddType application/x-compress. Z AddType application/x-gzip. gz. add AddType application/x-httpd-php. php (make Apcche support PHP) AddType application/x-httpd-php-source. phps: <IfModule dir_module> DirectoryIndex Index.html </IfModule> Add: <IfModule dir_module> DirectoryIndex index.html index. php </IfModule>: # ServerName www.example.com: 80 to ServerName 127.0.0.1: 80 or ServerName localhost: 80 remember to remove the previous "#" 9. Test and enter http: // 127.0.0.1 in the browser if It Works appears! It indicates the operation is successful. 10. Modify the default Web site directory to/usr/local/apache2/htdocs. Modify the apache configuration file httpd. conf, for example, in the new/home/gyw/WebSite directory as the apache site directory, find the DocumentRoot line and change it: find <Directory> In DocumentRoot "/home/gyw/WebSite" and change it: <Directory "/home/gyw/WebSite"> 2. Install PHP5.3.16 1. Download http://www.php.net/downloads.php2.pdf unzip tar-zxvf php-5.3.16.tar.gz3, create the target folder mkdir/usr/local/php, that is, php installed under install it in this folder. 4. Configure www.2cto.com and return to the decompressed folder. /config Ure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache/bin/apxs note here there is a-with-apxs2 =/usr/local/apache/bin/apxs option, apxs is generated when Apache is installed. apxs is a tool for compiling and installing extension modules for the Apache HTTP Server, so that the LoadModule Command provided by mod_so can be loaded to the Apache server at runtime. I understand that this tool is used to dynamically load the PHP module to Apache 5. Compile make 6, test and compile make test 7, install make install8, and configure the cp/usr/local/src/file/ php-5.3.16/php. ini-development/usr/local/php/lib/php. ini put the original php in the source code. ini-development copy to/usr/local/php/lib/php. ini and rename it to php. ini9. restart apache10 and test how to create a PHP file test under apache htdocs. php: <? Php phpinfo ();?> Enter http: // 127.0.0.1/test in the browser. if php configuration is successful, if nothing is input, it indicates that the configuration fails. Repeat the preceding steps or find the cause www.2cto.com. If you decide to change the configuration option after installation, you only need to repeat the last three steps of configure, make, and make install, and then restart Apache to make the new module take effect. Apache does not need to be re-compiled. 3. Install MySql1 and download mysql-5.1.65.tar.gz to the official website (note the source code package) 2. decompress the tar-zxvf mysql-5.1.65.tar.gz3 and create the target folder mkdir/usr/local/mysql. That is to say, install mysql in this folder. 4. Configure. /configure -- prefix =/usr/local/mysql/-- with-extra-charsets = all 2nd parameters indicate that ubuntu can use all character sets. 5. Compile make6 and install make install7, starting www.2cto.com MySQL does not automatically start, you also need to initialize the MySQL database as follows: cd/usr/local/mysql/bin sudo. /mysql_install_db -- user = root note: The last root here refers to the user who can operate the database. It is the current user. You can also create a new user. It is different from the root user on linux. you can name it yourself. /mysqld_safe -- user = root & this command is used to start the daemon process of the mysql service. In addition, this is because you want the daemon to run in the background. Here the root is the 8. Create a password for the root user. /mysqladmin-u root password '200' if the root user has set a password, use the following method. /mysqladmin-u root password oldpass '000000' 9. If mysql-u root-p is tested, the system prompts you to enter the password. Use the password 123456 you just set. If mysql> appears, the connection is successful. Run the following command to create a database, create a table, add a record, and prepare mysql> create database gywtest; mysql> use gywtes for subsequent tests. T; mysql> create table student (id int (4) not null primary key auto_increment, stuname char (20); mysql> insert into student (stuname) values ('Tom '); note that each command is followed by a semicolon. If the preceding command is successful, you can use this test later. 4. Combine PHP and MySql. 1. reconfigure PHP and change the configuration options. You only need to repeat the last three steps configure, make, and make install during PHP installation, then restart Apache to make the new module take effect. Apache does not need to be re-compiled. 2. configuration. /configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysqli =/usr/local/mysql/bin/mysql_config note mysql_config Path 3. Compile make4. Install make install5. test and write a page named test. put php in the apache web directory and test the database created with the command above. <? Php www.2cto.com $ mysqli = new mysqli (); $ mysqli-> connect ('localhost', 'root', '123', 'gywtest '); // create a query $ sqlstr = 'select * from student '; // send the query to MySql $ result = $ mysqli-> query ($ sqlstr ); while ($ row = $ result-> fetch_object () {$ name = $ row-> stuname; echo $ name ;}?> Output result: Tom. Verify that PHP and Mysql are configured correctly. 5. Install phpMyAdmin, a client management tool 1. Download phpmyadmin-3.5.2.2-all-languages.tar.gz 2. Unzip tar-zxvf phpMyAdmin-3.5.2.2-all-languages.tar.gz 3. Rename the decompressed folder to phpMyAdmin, put it in the apache site directory 4. Enter http: // localhost/phpMyAdmin/index in the browser. php shows the management interface.
 

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.