Create a database-driven dynamic website using Apache + PHP + MySQL

Source: Internet
Author: User
Apache is the most widely used Web server. PHP is an easy-to-learn scripting language similar to ASP, and has better performance and functions than ASP, mySQL is the most widely used database system in Linux, especially for website construction. All three software are free software and are database-driven Apache.

Apache is the most widely used Web server. PHP is an easy-to-learn scripting language similar to ASP, and has better performance and functions than ASP, mySQL is the most widely used database system in Linux, especially for website construction. these three software are all free software and are the best database-driven dynamic websites.

  I. required software:

Apache apache_1.3.12.tar.tgz (apache source code package)
PHP php-3.0.13.tar.gz (PHP3 source code package)
MySQL MySQL-3.23.24-1.sparch64.rpm (MySQL server)
MySQL-client-3.23.24-1.sparch64.rpm (MySQL client utility)
MySQL-devel-3.23.24-1.sparch64.rpm (MySQL contains files and libraries)
MySQL-shared-3.23.24-1.sparch64.rpm (client program sharing Library)

  II. install MySQL

First, check whether your system has installed MySQL:

Rpm-q MySQL
Rpm-q MySQL-client
Rpm-q MySQL-devel
Rpm-q MySQL-shared

If your version is earlier than 3.23.24 and you want to upgrade MySQL to 3.23.24, use rpm-e to delete all MySQL packages and:

Rpm-I MySQL-3.23.24-1.sparch64.rpm
Rpm-I MySQL-client-3.23.24-1.sparch64.rpm
Rpm-I MySQL-devel-3.23.24-1.sparch64.rpm
Rpm-I MySQL-shared-3.23.24-1.sparch64.rpm

When installing the MySQL server, the installer will prompt you to set the root password. For more information about the post-installation settings of MySQL, see.

The above installation puts the MySQL execution file under the "/usr/bin" directory, including the file under the "/usr/include/mysql" directory, the library files are stored in the "/usr/lib/mysql" directory.

  3. decompress apache and php and compile and install

Download the apache and php source code packages as described above, add the downloaded files to the directory "/apps", go to the "/apps" directory, and use ls to check whether you have these two files:

Apache_1.3.12.tar.gz
Php-3.0.13.tar.gz

1. decompress apache and configure

Decompress apache_1.3.12.tar.gz with the following command
Tar zxvf apache_1.3.12.tar.gz
The compressed file is stored in the directory apache_1.3.12. Configure apache
Cd apache_1.3.12 (go to the Directory of the apache source code tree)
./Configure -- prefix =/www (if you want to install apache in the directory "/www)

2. decompress php3 and configure and compile it.

Cd .. (back to the parent directory)
Tar zxvf php-3.0.13.tar.gz (extract to directory "php-3.0.13 ")
Cd php-3.0.13 (go to the php3 source code directory)
./Configure -- with-mysql =/usr -- with-apache = ../apache_1.3.12
Make
Make install

3. Compile and install apache

Cd ..
./Configure -- prefix =/www -- activate-module = src/module/php3/libphp3.a
Make
Make install (install apache under the "/www" directory)
The above method is to compile php into the apache target code, so its efficiency and performance are slightly better than the DSO method. Use php as apache
For the method of a module, see the introduction below.

4. configure apache

Cd/www (to apache Main Directory)
Cd conf (enter the configuration file directory)
Edit the "httpf. conf" file and remove the comment for the "AddType application/x-httpd-php3. php3" line so that
Files suffixed with ". php3" will be processed as php script files.

5. start apache

Turn off the running httpd (sometimes started at system startup) and restart the new httpd:
Cd/www/bin
./Apachectl start
Run the ps aux command to check whether httpd has been properly started.

6. test

Run startx, and then run netscape
In the address bar, enter:Http: // localhost
If you can see the page, it means you have set and started httpd correctly.

7. test php

Cd/www/htdocs (go to the default webpage storage directory)
Create an ex. php3 file with the following content:


$ Myvar = "Hello, World! ";
Echo $ myvar;
Phpinfo ();
?>


Run the following command to check whether the output is "Hello, World" and the current php settings:
In the address bar of netscape, enter:Http: // localhost/Ex. php3
If yes, your apache can already process php script files. Congratulations!

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.