All Products
Search
Document Center

Alibaba Cloud SDK:Install PHP on Windows

Last Updated:Aug 02, 2024

This topic describes how to install PHP and Composer on Windows.

Install PHP

  1. Visit the official download page of PHP for Windows. Find x64 Thread Safe and download the ZIP file.

    image

  2. Decompress the ZIP file and configure environment variables.

    1. Right-click the This PC icon and select Properties.

    2. Click Advanced system settings.

    3. On the Advanced tab of the System Properties window, click Environment Variables.

    4. In the System variables section, find and select the Path variable and click Edit.

    5. Click New to add the installation directory and extension directory of PHP. Examples: D:\php and D:\php\ext.

  3. Configure the php.ini file. The php.ini file is the PHP configuration file, which is mainly used to control the behavior and functions of the PHP interpreter.

    Find the php.ini-development file in the decompressed folder. The file is typically used in a development environment. Rename the file to php.ini.

  4. Check whether PHP is installed. Press the Win+R keys to open the Run window. Enter cmd and click OK to open Command Prompt. Enter php -v and press the Enter key. If the output is similar to the following code, PHP is installed.

    PHP 8.3.8 (cli) (built: Jun  4 2024 18:52:30) (ZTS Visual C++ 2019 x64)
    Copyright (c) The PHP Group
    Zend Engine v4.3.8, Copyright (c) Zend Technologies

Install Composer

Composer is a dependency management tool widely used by the PHP community. Composer provides features including dependency management, version control, automatic loading, and project initialization.

  1. Download the Composer installer: Visit the official download page of Composer and click Composer-Setup.exe in the Windows Installer section.

    image

  2. Install Composer: Double-click the Composer-Setup.exe file and install Composer by following the installation wizard.

  3. Check whether Composer is installed: Press the Win+R keys to open the Run window. Enter cmd and click OK to open Command Prompt. Enter composer -V and press the Enter key. If the output is similar to the following code, Composer is installed.

    Composer version 2.7.7 2024-06-10 22:11:12
    PHP version 7.4.33 (D:\ide\PHP\php.exe)
    Run the "diagnose" command to get more detailed diagnostics output.