The PHP language needs to be configured properly before it can be developed so that our program runs perfectly. So, how do you configure the PHP development environment correctly? The article will introduce Apache, MYSQL, php download, installation and configuration, respectively, in Windows and Linux environment for the development of the environment to build.
one, download Apache, MySQL and PHP
1, Apache download
The
Apache server can download Windows Apache installer via an officially provided mirrored address, but it is both in English and too slow to download. I suggest that you go to the Chinese army, the sky or Zhongguancun to download the latest version of the installation program, fast.
2, MySQL download
MySQL's official website is http://www.mysql.com. Can download the latest version of MySQL, or that sentence, we recommend to the Chinese army, the sky or Zhongguancun download.
3, PHP download
PHP's official website is http://www.php.net. You can download the latest version.
Two, configure the PHP development environment under Windows
1, Apache, MySQL and PHP installation like other Windows software, here we recommend the Apache and PHP software installed in the D disk directory, the MySQL software installed in the C disk, so no need to do any setup, MySQL can start running smoothly.
2, Configuration development environment
in order for Windows to execute PHP, further work needs to be done to build the environment in the following steps:
1 in the PHP installation directory, locate the file Php5ts.dll, copy it to the C disk system32 directory.
2 in the PHP installation directory, locate the file Libmysql.dll, copy it to the C disk system32 directory.
3 in the PHP installation directory, find the file php.ini, copy it to the c:/windows. This file is configured to configure PHP basic files, such as setting the server root configuration, using a text editor to open the php.ini file, find "doc_root=", because I installed the Apache default in the D-Packing directory, so modify the value of this configuration item is: doc_root=d:/ Apache2/htdocs
Hint: The user modifies the value of the configuration item according to the path of the Apache installation.
4) in php.ini find "Extension_dir =" "", this configuration item is used to load the extension module of PHP, modify the configuration item as follows: Extension_dir = D:/php/ext, (You need to modify PHP's loading location according to your installation directory).
5) Find the word "extension=php_mysql.dll" in php.ini and remove the semicolon before it, indicating that the item is in effect. This configuration entry is used to enable PHP to support MySQL, where the semicolon functions as an annotation. After modifying the PHP configuration file php.ini, save exit the file.
6) for Apache configuration. Go to the Conf directory under the Apache installation directory and open the Apache configuration file http.conf with a text editor. Dynamic shared Object (DOS) Support is found in this file, and the following configuration items are added at the end of the LoadModule line: LoadModule php5_module d:/php/ Php5apache2.dll, (You need to modify PHP's loading location according to your own installation directory). This item is loaded into the PHP module Php5apache2.dll via Apache, which is run by PHP as a module in Apache.
7 in order to allow Apache to support the. php suffix file, locate the AddType item 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 changed to Adddefaultcharset GB2312. Save http.conf after modification. That completes the basic configuration of Apache.
Note: It is strongly recommended that when you modify the Apache profile http.conf, you must follow the principle of modifying a little bit, that is, each time you finish modifying one item and saving After http.conf, want to restart Apache, if the Apache normal start, you can make subsequent changes, otherwise, explain this modification is wrong, carefully check and revise. (www.3lian.com)
Configure the PHP development environment under Linux
1, MySQL installation
on MySQL website to download the MySQL installation file mysql-server-4.0.20-0.i386.rpm, 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 the MySQL installation successfully with the following command.
mysql-u Root
appears like Welcome to the MySQL Mointor. The Word commands end with;or/g, which indicates the installation was successful.
2, Apache installation
downloaded the UNIX version of the compression pack 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 then uncompressed after entering the directory, the command is as follows:
cd/usr/local/src
TAR-ZXVF httpd-2.0.52.tar.gz
after decompression, enter the directory httpd-2.0.52, execute the following command:
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, configure the installation of the PHP development environment
1 Downloads the php5.1.4.tar.gz package from PHP's official website and compresses the package, which is ordered as follows:
tar-zxf php5.1.4.tar.gz
2) Go to the uncompressed directory, execute the following command to complete the PHP installation directory and other related configuration:
4 copies the current directory of files under the Lib directory of PHP large installation directory, and renamed to PHP.ini, command as follows:
CP Php.ini-dist/usr/local/php/lib/php.ini
5 After the installation of the PHP development environment is configured, see the configuration of the content configured under Windows, configuration items and configuration methods similar to
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.