Install PHP
Install PHP on Windows, Linux, or macOS before using the Alibaba Cloud PHP SDK.
Windows
Go to the PHP for Windows website, select a version (for example, PHP 8.3.8), and download the x64 Thread Safe ZIP file.
-
Extract the ZIP file and add PHP to your system PATH.
Right-click This PC and select Properties.
Click Advanced system settings.
On the Advanced tab, click Environment Variables.
Under System variables, select Path and click Edit.
Click New and add the PHP installation directory (for example,
D:\php) and the PHP extension directory (for example,D:\php\ext).
-
Configure
php.ini.In the extracted folder, rename
php.ini-developmenttophp.ini. This file controls PHP interpreter behavior and is suitable for development environments. -
Verify the installation. Open Command Prompt (press
Win+R, typecmd, and press Enter), then runphp -v. A successful installation outputs something similar to: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
Linux
-
Install PHP using your distribution's package manager:
-
Alibaba Cloud Linux/CentOS
sudo yum install epel-release sudo yum install php -
Ubuntu/Debian
sudo apt update sudo apt install -y php
-
-
Verify the installation.
Run
php -v. A successful installation outputs something similar to:PHP 8.4.10 (cli) (built: Jul 3 2025 12:41:53) (NTS) Copyright (c) The PHP Group
macOS
On macOS, use Homebrew to install PHP.
If you have network issues with Homebrew or PHP, use a mainland China mirror. For example, use the University of Science and Technology of China (USTC) open source mirror:
-
Install the latest version of PHP:
brew install php -
Verify the installation:
php -v
Next steps
Composer is the standard dependency manager for PHP projects. To install and configure it for use with the Alibaba Cloud PHP SDK, see Install and use Composer.