CityHost.UA
Help and support

How to use PHP interpreter in cli mode?

All possible versions of PHP are installed on the hosting, which you can choose for your site in the control panel.

 

In order to use the required version of PHP in cli (console) mode for cron tasks, launching various php scripts and implementations, you can use the same versions in the console by contacting the php interpreter of the required version.

 

php 5.X

php 5.2 ? /opt/alt/php 52 /usr/bin/php

php 5.3 ? /opt/alt/php 53 /usr/bin/php

php 5.4 ? /opt/alt/php 54 /usr/bin/php

php 5.5 ? /opt/alt/php 55 /usr/bin/php

php 5.6 ? /opt/alt/php 56 /usr/bin/php

php 7.X

php 7.0 ? /opt/alt/php 70 /usr/bin/php

php 7.1 ? /opt/alt/php 71 /usr/bin/php

php 7.2 ? /opt/alt/php 72 /usr/bin/php

php 7.3 ? /opt/alt/php 73 /usr/bin/php

php 7.4 ? /opt/alt/php 74 /usr/bin/php

php 8.X

php 8.0 ? /opt/alt/php 80 /usr/bin/php

php 8.1 ? /opt/alt/php 81 /usr/bin/php

php 8.2 ? /opt/alt/php 82 /usr/bin/php

php 8.3 ? /opt/alt/php83/usr/bin/php

 

Examples of use

$HOME is a variable that always leads to the root directory of the hosting.

example.com is an example site, here you need to substitute your own site on hosting accordingly.

script.php is a php script for an example, you need to substitute the path to your file.

 

Running script.php on example.com using php 7.4

/opt/alt/php74/usr/bin/php -f $HOME/www/example.com/script.php

 

If you need to use ready-made php site settings on hosting , you must use the -c key to download the .ini settings file. Useful for cases where you need to execute a script with special settings, for example the ionCube extension , which can be enabled for a site in the php hosting settings

/opt/alt/php74/usr/bin/php -c $HOME/.system/php/example.com.ini -f $HOME/www/example.com/script.php

 

If you need to specify or override the settings of the .ini file that is used by default, you must use the -d switch

/opt/alt/php74/usr/bin/php -d memory_limit=256M -d error_reporting=E_ALL -f $HOME/www/example.com/script.php