Installing ZendPHP on Windows (PowerShell Script)

Important This topic describes the legacy procedure for installing and uninstalling ZendPHP on Windows using a PowerShell script. This installation method is no longer supported. For new installations, use the instructions under Installing ZendPHP on Windows (MSI package) instead.

Requirements

  • Windows 10 or 11; Windows Server 2019
  • 64-bit architecture
  • Visual C++ 2017 or later runtime (the installer can install this for you)
  • Optional libraries that can be installed using the installer:
    • Management Information Base (MIBS) libraries; required for the SNMP extension
    • Oracle Instant Client libraries; required for the oci8/pdo_oci extensions
    • PostgreSQL client libraries; required for the pgsql/pdo_pgsql extensions

Getting the installer

To get the ZendPHP installer for Windows:

  1. Download ZendPHP for Windows Installer from https://www.zend.com/downloads.

  2. Extract the archive (ZendPHP-Installer-Windows.zip) on your machine. This can generally be done using Windows Explorer or in PowerShell using the command Expand-Archive ZendPHP-Installer-Windows.zip -DestinationPath {folder}, where {folder} is the location where you would like to extract the contents. The package contains a readme.txt file with instructions and the script zendphp_install.ps1, which is a PowerShell script.

  3. Start PowerShell and navigate to the directory in which you extracted the installer.

  4. Run zendphp_install.ps1 help to get usage details and a full list of options.

Installation notes

  • The installer notifies you if you do not have a compatible Visual C++ runtime. Use the -with-deps vcruntime option to install it.
  • We ship several PECL extensions separate from our standard PHP distribution. These include:
    igbinaryimagickmemcachemongodb
    pdo_sqlsrvredissodiumsqlsrv
    ssh2win32servicexdebug 
    The installer lets you install one or more of these at any time using the -pecl option (e.g., -pecl xdebug or -pecl memcache,redis). If you want to install these after installing PHP and without updating PHP, you can do so by passing the -deps-only switch.
  • You can enable one or more built-in extensions at installation using the -enable option (e.g., -enable intl or -enable curl,fileinfo). The -enable-all switch enables all built-in extensions.
  • After installing you can use the config sub-command to disable one or more built-in or PECL extensions using the -disable option (e.g., -disable intl or -disable curl,redis). The -disable-all switch disables all extensions.
  • You can install more than one PHP version at a time. By default, the installer installs to C:\zendphp\{version}, where {version} is the PHP minor version (e.g., 7.4, 8.1, and so forth). As such, you can install and configure PECL extensions for each PHP version independently.
  • If you are you using IIS, change the PHPRC and PHP_INI_SCAN_DIR environment variables in the PHP FastCGI settings. For more information, see Using ZendPHP with Microsoft IIS.

Installation examples

To install PHP 8.1, the Visual C++ runtime, the Microsoft SQL Server extension, and enable the curl, openssl, opcache, phar, and xsl extensions you would use:

zendphp_install.ps1 install 8.1 -with-deps vcruntime,msodbcsql -pecl sqlsrv -enable curl,openssl,opcache,phar,xsl

To later enable all built-in extensions for 8.1, but disable snmp, shmop, sysvshm, pdo_oci, pdo_pgsql, oci8, and pgsql you would use:

zendphp_install.ps1 config 8.1 -enable-all -disable snmp,shmop,sysvshm,pdo_oci,pdo_pgsql,oci8,pgsql

Updating

ZendPHP releases follow community PHP releases within a few days and community PHP releases are generally monthly. You can update your ZendPHP installation using the same command you used to install originally; the only difference is you typically do not need to use the -with-deps or -enable options.

As an example, if you installed PHP 8.1 using the following:

zendphp_install.ps1 install 8.1 -with-deps vcruntime -pecl sqlsrv -enable curl,openssl,opcache,phar,xsl

To update, you would use:

zendphp_install.ps1 install 8.1 -pecl sqlsrv

We recommend passing the -pecl option for any PECL extensions you normally install during updates to ensure you get patched versions.

Uninstalling

To remove a single ZendPHP version, delete the directory C:\zendphp\{VERSION}. If you specified a custom directory, replace C:\zendphp with the directory that you provided when calling zendphp_install.ps1 install.

To remove all ZendPHP versions, remove the directory C:\zendphp\, or, If you specified a custom directory when invoking zendphp_install.ps1 install, delete that custom directory.