Php/mysql 3rd Pass-First day (i) _php tutorial

Source: Internet
Author: User
Tags informix php and mysql web database
This paper introduces how to construct a network database application method of Php/mysql, which is a golden combination of web database, PHP is a server-side embedded hypertext Processing language similar to Microsoft ASP, and is a powerful tool to build dynamic website. MySQL is a lightweight SQL database server that can run on a variety of platforms, including Windows NT and Linux, and it has a GPL version that MySQL is considered to be the best product for building database-driven dynamic websites. PHP, MySQL, and Apache are the best partners for the Linux platform website. This tutorial is a 3rd course, which is described in detail from installation to application.

I. Introduction of PHP/MYSQL

You should have heard of open source software (OSS) unless you have been living on Mars for the last 6-8 months. The movement has a huge impact and has attracted the attention of some big companies. Like Oralce, Informix, and a number of companies are starting to transplant their main database products to one of the products of OSS-Linux operating system.

If you have enough technical power, having a complex and large relational database system (RDBMS) is a powerful one. But maybe you're just getting started with the database, and you just read Jay's article and decide you're going to have a data-driven website. However, you may find that you lack the necessary resources to run an ASP server or an expensive database system (you do not need these things). You need some free, UNIX-enabled stuff.

Then I suggest you use PHP and MySQL. Together, these two things are the best combination for the job of developing a data-driven website. In fact, I don't need to explain more. A non-official survey by Netcraft showed that the number of hosts that applied PHP jumped from 7,500 in June 1998 to 410,000 units in March 1999. Isn't that good? The combination of the two software also won the annual Database Product award at the Webcon98 Conference, and a beautiful trophy.

MySQL is a small database server software, ideal for small (and certainly not very small) applications. In addition to supporting standard ANSI SQL statements, it supports a variety of platforms, and on UNIX systems the software supports multi-threaded operation, which allows for fairly good performance. For users who do not use UNIX, it can be run as a system service on a Windows NT system or as a normal process on a Windows 95/98 system.

PHP is a scripting language for server-side interpretation. If you have been exposed to ASP, then you should be familiar with embedding code in HTML pages. The PHP code is interpreted as a normal HTML page content at one end of the server and is given to the browser at one end. This pattern allows us to use it to accomplish quite complex functions.

In addition to free this (of course, MySQL also has some restrictions on licensing), Php-mysql's portfolio can also be run across platforms, which means you can develop on Windows and then run Qiaoqi duo Yili HP as a standard CGI process to run on UNIX platforms. At this point it is a standalone script interpreter, or an embedded module of Apache.

If you are interested in using other database servers, PHP also supports Informix, Oracle, Sybase, solid and PostgreSQL, and General ODBC.

PHP supports some of the leading edge technologies for Internet development. These technologies include identity authentication, XML, dynamic image generation, WDDX, shared memory, and dynamic PDF documents. If you are not satisfied, PHP is easy to expand, so as long as you have the programming ability, you can do your best.

Finally, both of these software are developed collaboratively by a large number of programmers, so there are many ways to support documents and mailing lists. Bug fixes are quick, and if you ask for new features, someone will always consider your request and implement it if it is feasible enough.

That's enough! Let's take a look at some of the things in this tutorial.

The first lesson is about installing both software in UNIX and Windows environments. If you're not too concerned about the problem (perhaps you developed it on your ISP's server), you can jump straight to the first sample program and start your magical journey from there.

In the second lesson, we want to learn some more complex scripting features, such as looping, handling user input, exchanging data with a database, and so on.

The third lesson is to confirm the function and how to make your script clear and concise.

Here we go

Second, install MySQL

Hurry up and get these packages and study them carefully. It's not an easy thing to do. You have a lot of options for getting packages, compiling packages, and installing packages. Let's start with MySQL because we have it to run PHP.

The MySQL Central site is http://www.mysql.com/. In order to facilitate people to download the use (this software is still relatively large), there are many mirror sites around the world. For more efficient use of the Internet, please find a nearby website to download.

At this time you will also have a variety of options. If you are an enthusiast, you can download the source code; otherwise, there are pre-compiled binaries running on various platforms on the web that can be downloaded directly.

In addition, MySQL has a shared software version for Windows users, which has a slightly lower version number. If you want the latest version, you have to pay for a software license. MySQL also provides ODBC drivers that enable front-end applications to access the MySQL database. Some of the other details are available on its website and you can take a look.

The pre-compiled versions of UNIX and Windows are simple enough to be unpacked and used without much explanation. So let's take a look at the source code compilation. For Windows users, remember that you need to run the MYSQLD program, which is under the Mysql/bin directory.

Download the compressed package file and place it in a directory. Use gzip and tar to decompress and unpack the package. The quick way to do this is to use the following command:

Gunzip $#@60; mysql-xxxx.tar.gz | Tar xvf-

Where xxxx is a version tag that you take. The above command will create a directory named Mysql-xxxx, where all the source program files are in this directory. Go to the directory by executing the CD MYSQL-XXXX command, and read through the multiple Readme file install files carefully. These files can be a big help when you encounter some problems.

MySQL comes with some handy configuration scripts. Simply type in the./configure, and you can have these programs do a lot of work for you. If you need to explicitly specify what you want to do, you can use the./configure-help command, which lists the options you can use. For example, if you are compiling on a machine with less memory, you can use the--with-low-memory option. I like to install MySQL in a total directory instead of being installed in multiple directories on the machine, so I'll specify the installation directory and specify the-prefix option.

You can also specify a number of other options, such as what to skip during compilation, which parts to keep, and so on. We might as well assume that you want to install it all in the server's/usr/local/mysql directory. This means that we will type the./configure-prefix=/usr/local/mysql command.

When the configuration script runs, it checks your system and then generates some files to ensure that the compilation is running smoothly. If the script fails, it also displays some useful error messages that tell you why the failure occurred. You will often encounter a script that fails while looking for a multithreaded library file. At this point you should check to see if Mit-pthreads is installed on the system, and if not, install the software. Linux users must install the linuxthreads. These library files are critical for MySQL's multithreaded run mode (that is, running multiple versions of its own).

This news a total of 2 pages, currently on the 1th page 1 2


If everything goes well, simply type the make command and then you can go for a cup of coffee. MySQL is a fairly complex program that compiles for a period of time. If you find an error, you can check the documentation to see if you have missed some of the preparations related to your operating system.

Next, type the make install command, and all the required files will be installed in the appropriate directory. You're almost ready to start using it! If you're new to MySQL and you've never installed MySQL before, you'll need to create a default license to install it, so type ... scripts/mysql_install_db to set it up accordingly.

That's it. Our preparations are complete. The next thing to do is to start the database automatically when the machine starts and shut down the database automatically when the computer shuts down. Yes, there is also a dedicated scripting program for this job. The Mysql.server Start command can start the database, and Mysql.server stop can shut down the database. It's really easy. If you want to start the database manually (so you don't have to restart the machine), you go to the top-level directory where you installed MySQL (/usr/local/mysql) and type Bin/safe_mysqld & commands.

We have finished half of it. Next is the PHP section.

Third, install PHP

Well, when you see this, I hope you've installed and run MySQL. That's really fun! Here is the PHP ... The process is easier, but the vast array of options is confusing. Of course, you don't have to panic. You can always start over and recompile PHP, adding or removing an option as needed.

PHP's home in http://www.php.net/. The site is very informative, from development project content to software error reporting. As with MySQL, you can choose a mirror site that is closest to you to download. Obviously, you get the downloads part of the website to download PHP.

You don't have a lot of choices here. There are some pre-compiled binaries, but that's all experimental. If you are not on the Windows platform, download the source code and compile it yourself.

But let's talk about Windows first. When using PHP, the general practice is to develop on Windows systems and then run on UNIX servers. You may end up choosing this option, which requires you to be familiar with the installation of both platforms.

After you download the Windows binaries, you can unzip the files in the package to the PHP3 directory in the C drive using any of your favorite zip decompressor. The Readme file in the package explains some of the details of the installation process, but here's a reader's Digest of the key content in this file: If you don't want to install PHP in the C:PHP3 directory, instead of the other directory, you have to edit the. inf file in the extracted file.

In the PhP3 directory, you will find many. dll files. Move all the. dll files that do not start with the Php_ file name to the Windowssystem directory. Then, change the php.ini-dist file name, change it to Php3.ini, and move it to the Windows directory. If you open this file, you will find that there are a lot of interesting things to change. Right now

http://www.bkjia.com/PHPjc/532616.html www.bkjia.com true http://www.bkjia.com/PHPjc/532616.html techarticle This paper introduces how to construct a network database application method of Php/mysql, which is the golden combination of Web database, PHP is a kind of embedded hypertext Processing language like Microsoft ASP's server side, ...

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