Tutorial _php tutorial on building PHP Apache MySQL environment in Windows and Linux environments

Source: Internet
Author: User
Tags apache download php language mysql download mysql tutorial php development environment php download php software php website
Tutorial for building a PHP tutorial environment under the Windows and Linux environment

Detailed description of how to properly configure the PHP development environment
Before the PHP language can be developed, the development environment needs to be properly configured so that our program works perfectly. So, how to properly configure the PHP development environment? This article will introduce Apache, MySQL, php download, installation and configuration, respectively, in the Windows and Linux environment under the development of the building environment.

First, download Apache, MySQL and PHP

1, Apache download

The Apache server can download the Apache installer for Windows via an officially provided mirror address, but it is both English and slow to download. I suggest you go to the Chinese army, the sky or Zhongguancun download the latest version of the installation program, fast.

2. mysql Download

The official website of MySQL is http://www.mysql.com. Can download the latest version of MySQL, or that sentence, we suggest you go to the Chinese army, the sky or Zhongguancun download.

3, the download of PHP

The official website of PHP is http://www.php.net. You can download the latest version.

Ii. Configuring the PHP development environment under Windows

1, Apache, MySQL and PHP installation like other Windows software installation, it is recommended that Apache and PHP software installed in the D-disk directory, the MySQL software installed on the C-drive, so that no need to do any setup, MySQL can start running smoothly.

2. Configure the development environment

In order for Windows to execute PHP, further work needs to be done to build the environment as follows:

1) in the PHP installation directory, locate the file Php5ts.dll and copy it to the C-drive system32 directory.

2) in the PHP installation directory, locate the file Libmysql.dll and copy it to the C-drive system32 directory.

3) in the PHP installation directory, locate the file php.ini and copy it to c:windows. This file is the basic configuration of PHP files, such as setting up the server root directory configuration, open the php.ini file with a text editor, find "doc_root=", because I have Apache installed by default in the D-packing directory, so, modify the value of this configuration entry is: Doc_root=d: Apache2htdocs

Tip: Users modify the value of this configuration item according to their own path to install Apache.

4) Find "Extension_dir =" in php.ini./"", this configuration item is used to load the PHP extension module, modify the configuration entry as follows: Extension_dir = D:phpext, (you need to modify the loading location of PHP according to your own installation directory).

5) find "; Extension=php_mysql.dll" in php.ini and remove the preceding semicolon, indicating that the entry will take effect. This configuration item is used to enable PHP to support MySQL, where the semicolon acts as a comment. After modifying the PHP configuration file php.ini, save and exit the file.

6) perform Apache configuration. Go to the Conf directory under Apache's installation directory and open the Apache configuration file http.conf with a text editor. Find the dynamic Shared object (Dos) support in this file and add the following configuration entry at the end of the LoadModule line: LoadModule php5_module d:/php/ Php5apache2.dll, (you need to modify the PHP loading location according to your own installation directory). This item is loaded into PHP module Php5apache2.dll via Apache, PHP is run as a module of Apache.

7) in order for Apache to support the. php suffix file, locate the AddType entry in http.conf, and add the following configuration entry at the end: AddType application/x-httpd-php.php. Find DirectoryIndex and add index.php at the end. In order to support Chinese, find Adddefaultcharset iso-8859-1 to Adddefaultcharset gb2312 instead. Save http.conf When you are finished modifying. The basic configuration of Apache is completed.

Note: It is strongly recommended to modify the Apache configuration file http.conf, we must adhere to the principle of modifying a little bit of testing, that is, each time you modify an item and save http.conf, to restart Apache, if Apache normal start, you can make subsequent changes, otherwise, this modification is incorrect, carefully check and new changes.

Third, configure the PHP development environment under Linux configuration

1, the installation of MySQL

Download the MySQL installation file mysql-server-4.0.20-0.i386.rpm on the MySQL website and execute the following command to complete the installation of MySQL.

RPM-IVH mysql-server-4.0.20-0.i386.rpm

If the MySQL password is not set, test whether MySQL is installed successfully with the following command.

Mysql-u Root

A similar welcome to the MySQL Mointor appears. Commands End With;or G, stating that the installation was successful.

2. Apache Installation

Download the UNIX version of the compressed package from Apache's official website, taking httpd-2.0.52.tar.gz as an example, assuming that the resource bundle is placed under/USR/LOCAL/SRC and extracted into this directory, the command is as follows:

Cd/usr/local/src

TAR-ZXVF httpd-2.0.52.tar.gz

After decompression, go to directory httpd-2.0.52 and execute the following command:

./configure--prefix=/usr/local/apache2--enable--module=so

Where--prefix=/usr/local/apache2 is used to specify the installation directory for Apache. Next compile, execute the command to complete the installation.

Make

Mae Install

3. Configuring the installation of the PHP development environment

1) Download php5.1.4.tar.gz package from PHP website, unzip the package, command as follows:

TAR-ZXF php5.1.4.tar.gz

2) go to the extracted directory, execute the following command to complete the configuration of the PHP installation directory:

./configure--prefix=/usr/local/php-with-mysql=/var/lib/mysql

3) then compile PHP with the following command:

Make

Make install

4) Copy the file under the current directory under the Lib directory of the PHP large installation directory and rename it to php.ini, the command is as follows:

CP Php.ini-dist/usr/local/php/lib/php.ini

5) After the configuration of the PHP development environment is complete, see Configuring content under Windows for configuration, configuration items and configuration methods are similar.

http://www.bkjia.com/PHPjc/629848.html www.bkjia.com true http://www.bkjia.com/PHPjc/629848.html techarticle tutorial on how to properly configure PHP development environment in PHP tutorial environment of Apache MySQL Tutorial in Windows and Linux environment PHP language before development, you need to configure the development environment properly, ...

  • Related Article

    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.