Home  >  Article  >  Backend Development  >  php server build windows

php server build windows

WBOY
WBOYOriginal
2023-05-06 15:44:08717browse

In the process of building a website, the website server is an essential part, which allows the website to run normally and provides visitors with the required website content and services. In Windows systems, you can easily build a website using the PHP language and its corresponding server. In this article, we will discuss how to set up a PHP server in Windows operating system.

Before you start the installation, you need to make sure you have the following programs installed on your system:

  1. Windows operating system
  2. IIS (IIS is Windows’ own Web Server)
  3. PHP

In this article, we are going to use PHP version 7.3.5. You can download the corresponding version from the PHP official website. After installing PHP, unzip and find the PHP installation directory, for example: "C:\php".

Next, we start configuring PHP’s environment variables.

  1. Click the "Start" button, enter "Environment Variables" and select "Edit System Environment Variables";
  2. Click the "Environment Variables" button, and then in the "System Variables" below Click "New";
  3. Enter "PHP_HOME" in "Variable Name" and enter the PHP installation directory in "Variable Value", for example: "C:\php";
  4. In Find "Path" in "System Variables" and click "Edit";
  5. Click "New" and enter "%PHP_HOME%" in "Variable Value";
  6. Click "OK" and Close all windows.

At this point, the system environment variables have been successfully configured.

Next, how to add support for PHP in IIS.

  1. Open IIS Manager;
  2. Right-click "Site" and select "Add Website";
  3. Enter the name and physical path of the website;
  4. Select the IP address on the server;
  5. Enter "80" in the "Port Number" and click "Next";
  6. In the "Select Content Directory" page, select "From the following "Read content from location" and select the physical path of the website;
  7. Select "From Application Pool" in the action of the "Configure Application" page, and select "Default Application Pool" on the right ;
    8. Click "Next" and select "OK".

Now, if you try to open the website in your browser, you will find that the website does not work properly because we still need to do some PHP configuration.

  1. Open the "php.ini" file in the PHP installation directory;
  2. Find "extension_dir" and set it to the path of the PHP extension (usually "C:\php\ ext");
  3. Find "extension" and uncomment the "php_mysql.dll", "php_mysqli.dll", "php_openssl.dll" and "php_curl.dll" options respectively;
  4. Find "date.timezone" and set it to your time zone;
  5. Save and exit the "php.ini" file.

Now you can place a PHP file in the root directory of the website (e.g. "C:\inetpub\wwwroot"), such as a simple "hello world" program:

<?php
    echo "hello world";
?>

Now, you can visit this website in your browser, and you will see the string "hello world".

Summary: It is not difficult to build a PHP server in Windows system. You only need to follow the above steps one by one. If you encounter any problems, you can refer to the PHP documentation or official community, or on the Internet Get help.

The above is the detailed content of php server build windows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP implements scan loginNext article:PHP implements scan login