New to learn PHP, think manually set up the environment and distress? This article tells you how easy it is!

Source: Internet
Author: User
Tags learn php phpmyadmin

This tutorial is intended for beginners PHP, who want to learn about manually building PHP environments for children's shoes.

One-click Environment and master do not spray.

This tutorial takes the following versions of Software as an example:

Required Software Catalog

My directory structure here is (personal habits)

Installing and configuring Apache

Double-click Install Apache

Here we select the first one and then click Next.

Here to fill out a domain name, just fill in an email.

And then select

By default, 80 port is OK click Next.

Click Next.

Select the installation path here

Then click Intall

Installing in progress

Installation Complete

In the lower right corner here is the green one to show success!

When we enter localhost in the address bar, we will show It works!

By this Apache, the installation is finished.

Here I can introduce the Apache installation directory

APACHE2.2 Directory

├─bin--binary, binary, is the directory of executable programs such as Apache's main program and console

├─cgi-bin---Public Gateway Interface mode directory for program storage

├─conf---->config, configuration file directory

│├─extra---> Auxiliary configuration files

│├─original---> Original configuration file, can be resumed after the failure of the modification │

└─httpd.conf---the main profile, introducing the extra in the configuration file

├─error---> The information that is given to the customer in response to a request error.

├─htdocs---> Web page's home directory

├─icons---> Some small icons

├─logs---> Log information, where Error.log is the error log information, is helpful for our debugging.

├─manual---manuals, help documentation

└─modules---module catalog, placing various function modules

Here's how to modify the default home page

Newly installed Apache It's default home page is index.html

First we come to the apache2.2conf directory and find the httpd.conf file

We open it with a text editor.

Then we search for index.html.

Found in about 241 rows

If you specify only one directory and no Web page is specified, it accesses the index.html file in the specified directory by default.

This file can be set to multiple, and the priority is from front to back.

Here we can set it to index.html index.php

This way the server accesses index.html by default, and if not, the default access index.php

Note: After we have changed the Apache configuration file, we will restart it before it takes effect.

We can restart it with the command line (here we will start the command line in admin mode):

First enter the net stop apache2.2

Re-enter net start apache2.2

or restart the Apache service in Computer Management.

can also be restarted with Apache's own admin

How to modify the server root directory

Search the httpd.conf file for documentroot in about 179 lines We'll modify its root path

And then the following about 206 lines to be modified, notice to change the same as above

How to modify Apache's listening port

We then searched the httpd.conf file for 80 to find Listen in about 46 rows.

Listen is listening, which means it's listening on port 80 if we change it to 81 and then reboot Apache then we'll visit localhost again.

This is because the browser requests the HTTP protocol when the default access is 80 port, that is, if only write localhost, then it actually accesses the localhost:80, but we now change the listening port to 81, then we enter the URL should be written like this localhost:81.

Of course we can also let it listen to multiple ports, such as:

Installing and configuring the PHP interpreter

Now we create a new a.php file in the root directory and enter <?php echo ' Hello World ';?>

Then we open it with a browser which will display as content

Looks like it's not right. It can be seen that the PHP file is not parsed, but the original output ...

What is this for?

Because Apache is a server, it can only respond to something static, such as HTML, pictures, and so on.

But in a program like this, it can't be resolved, and then we're going to ask for PHP's interpreter.

Unzip PHP, and configure PHP.ini

We unzip it into the folder PHP5.3.2 and configure the php.ini

We found no php.ini in the catalog, but we can find these two files.

We are now in the learning phase, so we use development this file we will copy the Php.ini-development file and rename it to PHP.ini

Here we have two places to configure, one of which we extracted PHP into a directory like

PHP and Apache have a lot of extension modules, placed in the EXT directory.

EXT is a shorthand for extension, so we want to tell PHP exactly where it's extension_dir is.

We searched in php.ini extension_dir found Extension_dir = "" In approximately 807 rows.

We see a semicolon in front of the Extension_dir ";", this is the meaning of the note, that is, Extension_dir is commented out, now we remove the semicolon and change the path to D:ampphp5.3.2ext (your actual PHP directory)

This is the first place to configure.

The second place to configure, we search timezone in about 996 rows to find

TimeZone is used to adjust the time zone, because PHP has some functions to show the time, we are in the time zone is East eight, so let timezone= PRC also will be the previous semicolon removed.

Now that we've finished configuring the PHP interpreter, we're going to put the PHP interpreter and Apache together.

Integrated PHP interpreter and Apache

Let Apache introduce PHP modules, or introduce PHP interpretation engines.

We found somewhere in Apache's config file httpd.conf to tell apache,php where the configuration directory is, which is where php.ini is.

Find a place to enter Phpinidir "d:/amp/php5.3.2" (fill in the actual directory of your PHP) in the file.

This tells the Apache server php.ini the path.

Then we look at the PHP directory has a php5apache2_2.dll file, PHP and Apache connection all rely on it.

We then search for. So in the httpd.conf file, and then the Php5apache2_2.dll path at the back of. So.

Input LoadModule php5_module "D:/amp/php5.3.2/php5apache2_2.dll"

Finally, we tell Apache to invoke PHP to interpret the engine parsing if it encounters a file that ends in. php.

We searched for AddType, found in about 383 lines,

Then add AddType application/x-httpd-php. php. phtml

This means that if you encounter a file that ends in. php or. phtml, the PHP interpreter is invoked to parse it.

Now we reboot Apache, and this time we open the a.php file again and it will be parsed correctly.

Next Open the PHP function module

Search extension=php in PHP.ini we find the following

We will need to open the function module is OK.

I need these modules for the time being, which is usually used by novices and then we restart Apache.

When some modules are turned on, an error occurs when restarting Apache, because of compatibility issues we also need to introduce two files to the http.conf file in order to solve this problem.

LoadFile "D:/amp/php5.3.2/libeay32.dll"

LoadFile "D:/amp/php5.3.2/ssleay32.dll"

This will solve the problem.

At this time we enter <?php phpinfo () in a.php;?>

You can see the information in PHP.

If it fails at the end of the reboot, we will use the command line to restart the test, if the following error is reported

This is because the library file and header files for the appropriate VC compiler are not installed on the system and will resolve this issue after installation.

Installing and configuring Mysql

Double hit Open MySQL

Click Next

Once we've set it up, click Next to continue with the installation.

Installation in progress ...

Now start configuring MySQL, click Next to continue.

Here we select the details configuration and click Next.

Select the first and then click Next.

Here we can also place the InnoDB library under data.

Click Next

next! ~~~

next! ~~~

nnnnnnext!!!!!

Here according to your own needs can telnet, anyway I was not allowed, and then click Next.

One final step

Click Execute to do it.

After a long wait .....

Finally!!

Ha ha!! Ok!!

Finally click Finish, this installation is complete we open the command line to try.

Enter mysql–uroot–p password

If the following is displayed, the installation is successful!

Installing phpMyAdmin

This step should be the simplest.

Phpmyadmin is a b/s software, is a visual management of Mysql software, we directly unzip it to the root directory can be.

Then we open it directly in the browser

If the login page is displayed correctly, it will be successful.

If the following situation occurs

This problem occurs because the PHP mbstring extension is not open, or the PHP extension path is not specified correctly, please open the php.ini, the Extension=php_mbstring.dll front of the semicolon (;) to remove, in the php.ini add a Sentence extension_dir= "D:ampphp5.3.2ext"; Where D:ampphp5.3.2ext refers to the directory where the Php_mbstring.dll file is stored, that is, the PHP extension directory (the Ext directory in the PHP directory), please modify this directory path for your actual path.

Restart the server when you are finished modifying it.

The installation of the phpMyAdmin is over.

This tutorial is suitable for you want to know the manual build PHP environment of new children's shoes, do not like to spray, thank you!

This concludes the tutorial.

New to learn PHP, think manually set up the environment and distress? This article tells you how easy it is!

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.