Do something good first, turn the stuff, build a database-driven Web site with PHP and MySQL-_php tutorial

Source: Internet
Author: User
Tags learn php php and mysql web hosting
Abstract in this article, we will address the issues that will be encountered during the process of building a database-driven Web site. And we will only use two new tools, PHP and MySQL. If your web host supports Php/mysql, you'll save a lot of trouble.   If that's not the case, you don't have to frost, and we'll learn how to install the program under UNIX and Windows. This article is for advanced web designers who are likely to learn the development of server-side programs. We think our readers are familiar with HTML, so we don't give any explanation when we use HTML. In addition, we may use a small amount of javascript in some places, but we will try to make sure it is simple enough even for the novice. (2002-08-29 14:10:35)--------------------------------------------------------------------------------by Wing, Source: Linuxaid Original: Kevin Yank translation: The content is the most important for today's web. Once you have mastered HTML and learned some JavaScript and DHTML tips, you may now be able to design a beautiful web site that makes people "love at first sight." The next step is to add some real information to the Web page. Many sites have to succeed in attracting repeat customers by constantly updating them.   In traditional Web site construction, this means constantly updating numerous HTML files. Now the problem comes out, in more cases, the people who provide the content to the site are not the people who design the page. The content provider doesn't even know about HTML. So how does the content provider add content to the site?   Not all companies have a full-time webmaster, and it's a waste to get a webmasters to copy Word files to HTML templates all day long. To protect a text-driven site is a very painful thing. Many sites (do you also include your site?) ) is plagued by outdated information. You will have to rewrite hundreds of HTML files because you want to keep the information up to date. Server-side containment techniques (commands or pointers that can be invoked through comment lines in a ssi:html file) may be a little less cumbersome.   But you still have to face hundreds of HTML files, even if you just want to make some basic changes to your site. Solving these headaches is a site for designing a database. By separating the content and settings of your site completely, you can process one of them without affecting the other. You will no longer need to write an HTML page for each piece of information, you just need toIt is enough to write an HTML page for a class of information.   You don't have to constantly add new content to your page, all you have to do now is build a simple information management system that allows authors to add new content without HTML. In this article, we will tackle the problems that will be encountered during the process of building a database-driven Web site. And we will only use two new tools, PHP and MySQL. If your web host supports Php/mysql, you'll save a lot of trouble.   If that's not the case, you don't have to frost, and we'll learn how to install the program under UNIX and Windows. This article is for advanced web designers who are likely to learn the development of server-side programs. We think our readers are familiar with HTML, so we don't give any explanation when we use HTML.   In addition, we may use a small amount of javascript in some places, but we will try to make sure it is simple enough even for the novice. After reading this article, you should have understood how to build a database-driven website, you should basically learn PHP and SQL. Most importantly, you will learn how to start building your own database-driven Web site. Chapter One: Installation preface first of all, thank you for reading this tutorial! Over the next few months, I'll take you beyond the world of HTML and JavaScript designed by the client.   The current text-driven Web site is so successful, and what we're going to learn here is to solve the problem of maintenance. Before we begin, it is necessary to understand the two tools we need to work on.   In the first chapter, we will learn to download and install the two packages we will use: PHP and MySQL. PHP is a server-side scripting language. You can think of it as a "plugin" through which your Web server can no longer just issue a text-only web page after receiving a browser request. With PHP installed, your Web server can read a new type of file (PHP script) that allows the server to read real-time information from the database and add it to the Web page before responding to the browser's request.   PHP is completely free and you are free to download and use. To get information from a database, you first need to have a database, and then we have to mention MySQL. MySQL is a relational database management system (RDBMS). What role it plays and if it works, we will explain it in detail below. Basically, it's a software package that can organize and manage a lot of data very well. MySQL also makes it easy to get information through a server-side scripting language like PHP. MyNon-commercial applications for the SQL for unix-based platform (for example, Linux) are free. If you are lucky enough, your web hosting may have installed MySQL and PHP for you.   If this is the case, there are chapters that don't work for you, and you can jump straight to if your web host provides PHP and MySQL. Most of what we discussed in this tutorial applies to windows-based or unix-based servers. But depending on the type of server you are using, the installation process will be different. The next section explains how to install on a windows-based Web server. The following section explains how to install under Linux (and other unix-based platforms). If you are not particularly interested in the installation process, you just have to choose to read the section that is right for you. Under Windows installation you can go to http://www.mysql.com/(or one of the mirror sites listed in http://www.mysql.com/mirrors.html) and select downloads for Windows MySQL related software->downloads->register and download shareware version of Mysql-win32, after downloading the file,   Unzip it and run the Setup.exe. Once you've installed it, MySQL is ready to use (excluding some of the configurations we'll be doing shortly). Like your Web service, MySQL is also a service that can run in the background, so it can respond to requests for information at any time. This service program you can find in the bin subdirectory under the MySQL directory you installed. If you are using a shared version, this service is called Mysqld-shareware.exe. Before execution, rename it to Mysqld.exe. At the MS-DOS prompt, open the service with the following command: c:mysqlin> mysqld to make sure that the service is turned on when Windows starts, you need to create a shortcut and add it to the Startup program group. In addition, you can install this command as a service for Windows nt/2000: c:mysqlin> mysqld-nt--install If you have a problem running a shared version under Windows nt/2000, You can try to run this service in standalone mode: c:mysqlin> mysqld--standalone The next step is AnnInstall PHP. At the time of writing this tutorial, PHP 4.0 has basically matured. I have tried PHP 4.0-rc2 myself, and I have not encountered any problems.   It is estimated that the final stable version will be released soon (maybe we haven't finished the tutorial yet), and I suggest you install the latest version so that you don't have to make any changes when the official version comes out. PHP can be downloaded free of charge from http://www.php.net/(or one of the mirror sites listed in http://www.php.net/mirrors.php). You need the "binaries for Win32" package. You can get a good PHP 3.0 for Windows installation Guide from the following address: http://www.umesd.k12.or.us/php/win32install.html. When PHP 4.0 releases the final version, you may need to upgrade, but the 4.0 installation is basically the same as 3.0.   You won't get into any trouble because of the version you choose. After MySQL and PHP are installed, you are ready to go to the installation configuration. Installation under Linux This section describes the process of installing PHP and MySQL under Redhat Linux.   If you are using a different version of Linux, or if you are using another unix-based operating system, these steps are very similar, even if they are not identical. As a Redhat Linux user, you may be interested in downloading and installing the RPM release of PHP and MySQL. RPM is really excellent, and the installation of prepackaged software is very easy. Unfortunately, they also limit how you choose to configure your software.   For this reason, I think that the use of PHP and the RPM version of MySQL brings more trouble than it really is worth. Because some Redhat linux default configuration will automatically install PHP for you, so the first step is to remove the old version of PHP and MySQL from your system. You need to log in as Superuser to execute the following command. Note in the following command, "%" represents the shell prompt, which is not required for you to enter. % rpm-e mysql% rpm-e php If either of these commands or one of the display programs is not installed, do not worry. If the second command executes successfully (that is, does not display any information), it proves that the old version of PHP is installed and you must remove it completely. Open the Apache configuration file (usually/etc/httpd/conf/httpd.conf) with the text editor you are accustomed to, looking for these two lines of content. These two lines are usually in different parts of the file, so if these two lines are not together, there is really nothing to worry about.LoadModule php3_module modules/libphp3.so addmodule mod_php3.c These two lines are used to tell Apache to load PHP as a plug-in module. When you uninstall this module, you also need to delete the two lines to ensure that Apache works properly.   You can also make it a comment by adding (#) At the beginning of the two lines. To make sure Apache is still working, you must now restart it without a PHP plugin:%/etc/rc.d/init.d/httpd Stop/etc/rc.d/init.d/httpd start everything is properly arranged, You are ready to download and install MySQL and PHP. The version of MySQL MySQL for Linux installed under Linux is free and you can get from http://www.mysql.com/(or http://www.mysql.com/downloads/ One of the mirror sites listed in mirrors.html) download the last stable version (listed in "Recommended" on the download page).   You should get the version of "tarball source download" whose file name is mysql-version.tar.gz. After downloading the files, you must make sure you are logged in as Superuser, unless you want to install MySQL in your own home directory only. Start unlocking the downloaded file and go to the newly created directory:% tar xfz mysql-version.tar.gz% CD mysql-version below you need to configure the installation of MySQL. Unless you are absolutely sure, you will need to specify the installation directory. I recommend using/usr/local/mysql:%./configure--prefix=/usr/local/mysql after the monitor and monitor configurations have been detected, you will eventually return to the command prompt. Now you can compile MySQL:% make after compiling, you will return to the command prompt again. Now you can install your newly compiled program:% make install now MySQL is installed, but

http://www.bkjia.com/PHPjc/532240.html www.bkjia.com true http://www.bkjia.com/PHPjc/532240.html techarticle Abstract In this article, we will address the issues that will be encountered during the process of building a database-driven Web site. And we will only use two new tools, PHP and MySQL. Like ...

  • 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.