Please use the “Print” function at the bottom of the page to create a PDF.
Valid for Linux Web Hosting.
Although the PHP scripting language was primarily developed for the creation of dynamic websites, PHP scripts can also be executed completely independently of the web browser. For this purpose, the corresponding PHP file can be called with the so-called PHP Command Line Interpreter (PHP CLI for short) on the command line with the desired PHP version. In the following you will learn how to use PHP CLI to execute PHP files in your webspace.
Requirements
To execute PHP files with PHP CLI, you need:
- An SFTP account with SSH support. Further information can be found in the article Creating an SFTP/SSH account.
- The connection data for your SFTP account. Further information can be found in the article Connection data for Secure FTP.
- A device with an installed SSH program (SSH client). For computers with a Windows operating system, we recommend the PuTTY program. Download PuTTY.
Available PHP versions
Below is a list of all PHP versions that can be used with PHP CLI. The path to the corresponding PHP CLI program is listed below (more on this in the next section).
Notes
- The correct path to PHP CLI depends on the order date of your web hosting contract. Please check your contract date to find the correct path from the list below.
- PHP versions that are no longer updated by the PHP Group (the organisation responsible for the development and maintenance of the PHP programming language) and should therefore no longer be used, and are marked with the suffix "obsolete." Only use these PHP versions if updating the script is not possible, and using the older PHP version is necessary for compatibility reasons.
Version | Path |
---|---|
PHP 8.4 | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php8.4-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php8.4 |
PHP 8.3 (recommended) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php8.3-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php8.3 |
PHP 8.2 | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php8.2-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php8.2 |
PHP 8.1 | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php8.1-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php8.1 |
PHP 8.0 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php8.0-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php8.0 |
PHP 7.4 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php7.4-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php7.4 |
PHP 7.3 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php7.3-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php7.3 |
PHP 7.2 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php7.2-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php7.2 |
PHP 7.1 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php7.1-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php7.1 |
PHP 7.0 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php7.0-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php7.0 |
PHP 5.6 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php5.6-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php5.6 |
PHP 5.5 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php5.5-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php5.5 |
PHP 5.4 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php5.4-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php5.4 |
PHP 5.2 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php5.2-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php5.2 |
PHP 4.4 (deprecated) | Web hosting contracts purchased before September 15, 2025 Path: /usr/bin/php4.4-cli Web hosting contracts purchased from September 15, 2025 Path: /usr/bin/php4.4 |
Executing PHP files with PHP CLI
- Start your SSH client and connect to your webspace. A terminal window with the Linux command line will open. Carry out the following steps in this terminal window.
Tip: The following article describes how to connect to your web space with the SSH client PuTTY: Connecting to your webspace via Secure Shell (SSH) using PuTTY.
Change to the directory in which the PHP file you want to execute is located. Execute the command cd in the terminal according to the scheme cd <directory path >. For example, to change to the relative scripts directory, enter the following command and then press the Enter key to execute the command.
cd scripts
To execute a PHP file, enter the path to the PHP CLI program followed by the name of the PHP file in the terminal. The path for the desired PHP version can be found in the table above. For example, to execute the PHP file my_script.php with PHP 8.3, execute the following command:
Example for contracts purchased before September 15, 2025/usr/bin/php8.3-cli my_script.php
Example for contracts purchased from September 15, 2025/usr/bin/php8.3 my_script.php
Please Note
Do not execute PHP files with the php or /usr/bin/php command, as this will result in the script being executed with the outdated PHP version 4.4.
This also applies to the configuration of web applications: If your web application contains a setting for the path to the PHP program, check whether /usr/bin/php is entered there. If so, replace /usr/bin/php with the path of the PHP CLI version to be used.