Wamp Environment Construction

Source: Internet
Author: User
Tags mysql commands

Although the ideal environment for PHP running is lamp, and there is any Wamp on the Internet to build a one-step package, but in view of some of the scum (such as myself), I have not engaged in Linux, in addition, windows may have been installed in this version. The important thing at present is to first learn PHP knowledge, knock on the code to see the effect, and then add the Linux part in the future, it is necessary to manually repeat the Wamp construction step by step.

I will not elaborate on the Installation Steps of various Wamp software. I will refer to the online tutorials. Here we will talk about the configuration process (excluding phpMyAdmin) in win7 and 32 bits. I have seen many configuration processes, after I walked it on my machine, I found that it was always incorrect. Then I gave a comment, "This TM is a waste of LZ life ", I hope this will not cause such evil consequences to you after reading it ...... =

First of all, assume that you install the software in the recommended way, and each software is deployed in different directories. Mine is:

During installation, Apache, MySQL, and PHP should be placed separately, and it is not recommended to be placed on commonly used C-disks. After the C-disk software is installed, many files are easy to mix up, it is better to set up another D and E disks. It is clear and easy to configure.

Before configuration, you should install a text editor software, such as NotePad ++, editplus, ultraedit, and so on.

(1) Apache configuration

First, find the main configuration file httpd after Apache installation. conf, for example, under D: \ Wamp \ apache2.2.22 \ conf, it is best to open it in the notepad ++, editplus, and Other Editors. Do not use your own notepad, the advantage is that they do not break the encoding structure of files and reduce the chance of errors.

* Find DocumentRoot "D:/Wamp/apache2.2.22/htdocs (similar to), which is about 179 rows. The path behind it indicates the place where the script source file is stored, this is equivalent to the directory where the web files are stored on the server on your own machine. Change it to the installed WWW directory. For example, mine is:

Note that double quotation marks must be entered in the English half-width environment, and the Directory separator should use a forward slash/, even in windows.

Find <directory "D:/Wamp/apache2.2.22/htdocs"> (similar to), and change it to the directory path where the script source files are stored in the same way as above in line 206,

* Find the directoryindex option, which is about 241 rows. This option refers to the index file identified by Apache by default. That is, when you enter a URL in the browser address bar, if you only enter a directory without specifying the file under which the directory is run, Apache will first find these files and run them by default, if not found, an index list of files and directories under the directory will be generated, similar to the case

This is the default configuration in Apache of windows. Whether the index of files and directories will be displayed depends on the configuration options. For example, set my directoryindex option:

In this case, you will find three index.php?index.html=index.htm files when you are running your scripts without specifying them. These files will not run in other formats. If all three files exist, you should first run the files written in front of them.

* Add phpinidir "D:/Wamp/php5.4.10" to link Apache to PhP. Some articles say that the modified line should be added after loadmodule actions_module modules/mod_actions.so. This is not a required test, just start a line. For example, at the end of the configuration file, the path of the double quotation marks after phpinidir is the installation directory of PHP. Change it to your own PHP installation directory. Mine is:

* Add loadmodule php5_module "D:/Wamp/php5.4.10/php5apache2_2.dll". You must write your own PHP installation directory. Check whether php5apache2_2.dll extension file is available under the PHP installation directory, if your PHP version is another version, its name may be different. For example, php4apache1. DLL, change it to "D:/Wamp/php5.4.10/php4apache1. DLL ", my is:

Some articles have said that this line should be added after # loadmodule vhost_alias_module modules/mod_vhost_alias.so. It is not necessary to test the default configuration environment.

* Add the file types that PHP programs can run. They can be written together or separately, indicating that all files in these formats can run php programs. For example, I write them together:

Separate write can be:

Save the changes. Now, Apache configuration is complete.

(2) PHP configuration

For PHP installation, you only need to extract the downloaded compressed package to the specified directory, and the program will run these files once during runtime. The changes will take effect immediately.

First, find PHP in the root directory of PHP installation. ini-development or PHP. ini-production file, one of which is the development version, the other is the product version, and the other is changed to PhP. INI save. It is better to back up an original file before the change. It is best to use the notepad ++ editor to open these files again.

* First, find extension_dir = "Ext", which is roughly in line 730, and change it to the directory where you can store PHP extension files after installing PHP on your own, the directory for storing PHP extension files is the ext folder under the installation directory. DLL format extension files, such:

Change to your own path.

* Locate around 870 rows and you will see many rows similar to extension = php_fileinfo.dll. They are the option to open the extension library in PHP, the functions used in the phpz program are all completed by the extension cry, which is a bit similar to the header file of the C language. If you want to use any extension library, remove the semicolon. As a PHP program that has just been installed, you do not need to enable too many extensions. The following are usually enough to remove the semicolons before them and save them.

Extension = php_bz2.dll

Extension = php_curl.dll

Extension = php_gd2.dll

Extension = php_mbstring.dll

Extension = php_mysql.dll

Extension = php_mysqli.dll

Extension = php_openssl.dll

Extension = php_pdo_mysql.dll

Extension = php_pdo_odbc.dll

Extension = php_pdo.dll

So far, PHP configuration is complete.

I have seen many articles that I want to write and modify. Date. timezone, short_open_tag, and other options are completely unnecessary. You can try again or directly modify the program when writing a program.

(3) MySQL Configuration

Most of the configurations of MySQL are solved during software installation, and there is basically no need to make subsequent manual modifications. Of course, please install them in the directory of the specified category according to the specifications.

* Find My. INI file, which is opened in the editor under D: \ Wamp \ mysql5.6.20 \ data. Find the datadir option. This is the directory of the physical file that stores Mysql Data, which is about 90 rows, modify the path in the double quotation marks behind it to store Mysql Data for you. You can create a new data directory under the root directory of a disk and store it directly in D: \ Wamp \ mysql5.6.20 \ data, create a new data folder to store data. You can follow your own ideas. Therefore, after my datadir is changed:

For example, if your data directory is stored in disk D, it is datadir = "D:/data/". Note that the directory delimiter uses a forward slash /.

So far, MySQL configuration is complete.

How can I know that the configuration is successful?

Open notepad ++, create Ctrl + N, create a file, enter the following content, and save it to the directory where the configured web source file is stored, such as WWW, and start a file named phpinfo. php.

<? PHP

Phpinfo ();

Open the browser and enter localhost/phpinfo. PHP Press enter. If the following page shows that the configuration is successful, the page displays information about Apache, PHP, MySQL, and PHP extensions that are currently in use. If not, that ..... you can only find the reason.

The phpMyAdmin configuration is not written here. I think the command line of MySQL or the CMD of Windows is enough, and it is very convenient. It can also help us strengthen the use of SQL statements, of course, the premise is that some MySQL commands are required.

 

Wamp Environment Construction

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.