Install and configure the Apache + PHP + mysql + phpMyAdmin source package in linux
Source: Internet
Author: User
Install and configure the Apache + PHP + mysql + phpMyAdmin source package in linux 1. install Apache2.2.221. download the ghost from the official website...
Install and configure the Apache + PHP + mysql + phpMyAdmin source package in linux 1. install Apache2.2.221 and download it from the official website. http://httpd.apache.org/download.cgi 2. decompress www.2cto.com tar-zxvf httpd-2.2.22.tar.gz3 and create the destination folder (note that all of the following operations are performed 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. 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 found: DirectoryIndex index.html Add: DirectoryIndex index.html index. php Find: # ServerName www.example.com: 80 and change it to ServerName 127.0.0.1: 80 or ServerName localhost: 80. remember to remove "#" 9 from the front and enter http in the browser: // 127.0.0.1 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 directory of creating a/home/gyw/WebSite as the apache Site Directory, find the DocumentRoot line and change it to: DocumentRoot "/home/gyw/WebSite" This line is changed: 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 to say, etc. install php in this folder 4. configure www.2cto.com back the original decompressed folder. /configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache/bin/apxs note here there is a-with-apxs2 =/usr/local/apache/bin/ apxs options, 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: Enter http://127.0.0.1/test.php If the related php configuration is successful, if nothing is entered, it indicates that the configuration fails. Repeat the above 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 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.
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.