PHP Basic Tutorial One of the development environment configuration

Source: Internet
Author: User
Tags file copy learn php php development environment


Objective


PHP Basic tutorial, hope to help a few people want to learn PHP, but also their knowledge of the basics of the deepening of understanding, summary, the development of basic knowledge is very key, hope to learn PHP people can adhere to go on, but also hope that they can more and more NB.

What this section explains

    • Detailed installation of PHP environment variables.

    • PHP editing software

The overall process

PHP is a development server-side language, and you want to access the server on your own computer, you can install an Apache server on your own computer. This allows you to access your computer's Web pages on your computer via a browser.

When we visit the website, General access is the end of the. html file, this file is browser-based parsing, but when the browser to access the. php suffix file, the browser can not parse, then you need to PHP code to PHP Development module parsing, and sometimes PHP code to operate the database, then you need PHP module and database associated.

The approximate flowchart is this:

The Apache version we're using here is 2.4.
The version used for PHP development is 5.6.25;
The database used to develop PHP is mostly MySQL database, a relational database, here we use the version is
5.6.27.
Installation recommendations create an empty folder that is easy to manage by installing three of modules together.

Installation of Apache

Download Apache installation software, Link:
http://www.php.cn/
After the download is complete, you can install it, but Apache installs it on the command line.

    1. Install Apache, first we create a folder (for unified management), such as d:/mywamp, note that the folder does not have Chinese and white space.

    2. After the download of the extracted Apache24 (name can be named) the entire copy of the directory to D:/mywamp, under

    3. Go to the command-line console and run to the bin directory of the installation directory by clicking Run-and-command-line, as Administrator.

    4. In the Bin directory, enter the Httpd-k install installation,

      You may be having problems here

      Download the software to install it to solve. Link:
      http://www.php.cn/
      When the above instructions indicate that the installation is successful, but there is a problem with the Apache configuration file, we need to modify the Apache configuration file apache24/conf/httpd.conf file

    5. Here, after we install, we need to modify the Apache installation directory/conf/httpd.conf, in the file of about 38 lines, modified into a specific installation location.

    6. After that, we enter (or in the bin directory) in the command line Httpd-k start to start the service. Access is only available to our browser when the service is turned on.

    7. When the service is opened, call the browser, enter the localhost URL, when you see this screen

      Instructions to install Apache successfully.

But sometimes we will see a message that our 80 port is occupied, then you can modify the Apache port to resolve, or the apache24/conf/httpd.conf directory

Modify it, restart the server on the line.

The commands that are commonly used when working with Apache are:

    • Httpd–h: View All commands

    • Httpd–k Install: Installing Apache

    • Httpd–k start: Start Apache

    • Httpd–k STOP: Stop Apache

    • Httpd–k Restart: restarting Apache

    • Httpd–k Uninstall: Uninstalling Apache

Configuration of environment variables:

When we start the server, reboot, shutdown and so on to enter the bin directory, it is too troublesome, there is a workaround, configure the environment variable, so that you can start in any directory.
Configuration steps:

    1. Environment variables, such as advanced environment configuration, properties like computers, you will see the following interface

    2. To create an Apache variable

    3. Find the path variable click, after the value of the variable if there is no semicolon, add a semicolon and then fill in the%apache%;

    4. Here, the environment variable is configured. Close the command-line window and reopen it.

Directory structure

Note: Where Htdocs is the file you want to access through the browser.

PHP Installation

Download the PHP version link:
http://www.php.cn/
Copy the extracted file (the filename can be named) to the file you created yourself, my name is d:/mywamp/php
PHP modules are not installed, this is as long as the Apache and PHP modules to integrate together on the line.
Steps:

    1. Modified the apache24/conf/httpd.conf file

    2. PHP module to the configuration file extension to find PHP directory php.ini-development file copy and renamed to PHP.ini

    3. Open PHP Extensions for PHP and other functions, such as MySQL.

    4. Change the path of an extension

    5. To restart Apache, you can use the PHP module functionality. A test.php can be created under Apache's Htdocs directory, and File writes

      Open the file in the browser. http://www.php.cn/when you see this picture, it means success.

MySQL Installation

Download the PHP version link:
http://www.php.cn/

Specific installation

    1. Double-click Install software

    2. Choosing a Custom Installation

    3. Specify installed components and paths to your own file directory

    4. Start the configuration

    5. Choose how to configure

    6. Set default concurrency number

    7. Configure the port of MySQL, generally we do not modify the port number.

    8. Select the default character set for our database-utf8

    9. Specify the MySQL service name and whether to add to the environment variable

    10. Root user Password specified

    11. Start MySQL

When the front of the four is a check mark, the installation is successful.
12. Test whether MySQL database can be used properly, here we need to be careful to ensure that MySQL is running state
Modify the following code in the apache24/htdocs/test.php file above.

if Access returns "Connection succeeded" say OK
However, during the installation process, sometimes we are prompted for the missing. net40 file, download link:
http://www.php.cn/

How to enter the MySQL console after successful installation:

If it is easy to operate, you can set an environment path. The same as Apache.

PHP editing software

Write PHP code in development, you can use Notepad, but Notepad is too low, for beginners can use EditPlus or sublime

Sublime Download Address

EditPlus Download Address

Summarize

To this, our PHP development environment configuration is complete, the most important is the integration of PHP module and Apache module, note that the letter should not be written wrong. Colleague MySQL installation process note the meaning of each option. Do not choose the wrong.

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