Running PHP Scripts from the Command Line

You can run PHP scripts in the Command Line for a particular PHP version used in Plesk.

On Linux

In Plesk for Linux, the PHP binary (the php file) is located in the following path:

/opt/plesk/php/<PHP version>/bin/php

Here <PHP version> should be replaced with a particular PHP version number.

For example, if your domain uses PHP version 7.0, use the following command to run the my_script.php script:

/opt/plesk/php/7.0/bin/php my_script.php

On Windows

In Plesk for Windows, use the following paths for running PHP scripts:

<%plesk_dir%>\Additional\PHP\php.exe - for PHP 4.x

<%plesk_dir%>\Additional\PHP5\php.exe - for PHP version 5.2.x,

<%plesk_dir%>\Additional\PHP53\php.exe - for PHP version 5.3.x,

<%plesk_dir%>\Additional\PHP54\php.exe - for PHP version 5.4.x,

<%plesk_dir%>\Additional\PHP55\php.exe - for PHP version 5.5.x,

<%plesk_dir%>\Additional\PHP56\php.exe - for PHP version 5.6.x,

<%plesk_dir%>\Additional\PHP70\php.exe - for PHP version 7.0.x.

Here, <%plesk_dir%> is the directory where Plesk is installed, usually, it is C:\Program Files (x86)\Plesk.

For example, if your domain uses PHP verion 7.0, use the following command to run the my_script.php script:

C:\Program Files (x86)\Plesk\Additional\PHP70\php.exe my_script.php