Aller au contenu

Changing your PHP version and settings (Select PHP Version)

Ce contenu n’est pas encore disponible dans votre langue.

Ruachost hosting uses CloudLinux Select PHP Version (also called PHP Selector) in cPanel. It’s where you change your PHP version, switch extensions on or off, and change PHP settings such as the memory limit or maximum upload size. You don’t need to edit php.ini or .htaccess files.

  1. Log in to cPanel and open Select PHP Version under Software.
  2. Next to PHP version, open the list and choose a version.
  3. The change applies straight away. Reload your website to check it.

You can choose PHP 5.2 to 8.5. New accounts start on PHP 8.2. The version marked native is the server’s built-in PHP.

Which version should I use? Use the newest version your website supports. Newer versions are faster and get security fixes. Today we recommend PHP 8.2 to 8.4 for WordPress and most modern apps. Versions older than 8.1 no longer get security updates, so only use them for old scripts that can’t be upgraded.

Before you upgrade, update your website software, plugins and themes, and take a backup. If something breaks, switch back to the previous version and see Resolving common PHP upgrade issues.

  1. In Select PHP Version, open the Extensions tab.
  2. Tick an extension to turn it on, or untick it to turn it off. Changes save automatically.

More than 100 extensions are available, including imagick, intl, redis, memcached, ioncube_loader, sourceguardian, opcache, soap, sodium and zip. Greyed-out extensions are built in and always on.

Each PHP version has its own list of extensions, so check them again after changing version. To undo your changes, click Reset PHP Extensions to default.

  1. In Select PHP Version, open the Options tab.
  2. Click the value next to a setting and choose or type a new one. Changes save automatically.

These are the settings people change most, and their default values on Ruachost:

Setting Default What it does
memory_limit 512M The most memory one PHP script can use. Choose up to 2G. See PHP memory limit vs your plan’s RAM.
upload_max_filesize 512M The largest file you can upload through your website.
post_max_size 512M The largest form submission, including uploads. Keep it the same as or bigger than upload_max_filesize.
max_execution_time 60 How many seconds a script can run before it’s stopped.
max_input_time 600 How many seconds PHP spends receiving form data and uploads.
max_input_vars 10000 How many form fields a request can have. Raise it if large menus or settings pages don’t save fully.
date.timezone UTC The time zone PHP uses. For Nigeria, use Africa/Lagos.
display_errors Off Shows PHP errors on your web pages. Keep it Off on a live site. See PHP error logs.
log_errors On Writes PHP errors to an error_log file.
allow_url_fopen On Lets PHP open files from other websites. Some apps need it.
error_reporting All except deprecated Which kinds of errors PHP reports.
disable_functions Empty Functions you want to block on your account.
short_open_tag Off Allows <? instead of <?php. Only old scripts need it.
zlib.output_compression Off Compresses PHP output. LiteSpeed already compresses pages, so leave it Off.

To undo a change, set the value back to the default shown above.

Changed the version, but your site still shows the old one?

Section titled “Changed the version, but your site still shows the old one?”
  • Check .htaccess for old PHP handler lines. Lines like AddHandler application/x-httpd-ea-php74___lsphp .php (often left by a previous host or an old cPanel tool) force a fixed PHP version and override Select PHP Version. In File Manager, open .htaccess in your site’s folder (turn on Show Hidden Files), and remove or comment out any AddHandler or SetHandler line that mentions PHP. Take a copy of the file first.
  • Clear your caches. Purge LiteSpeed Cache or your site’s caching plugin, and your browser cache.
  • Check the version your site really uses with phpinfo().

Using php.ini, .user.ini or .htaccess instead

Section titled “Using php.ini, .user.ini or .htaccess instead”

Select PHP Version is the easiest and most reliable way to change PHP settings, and its settings apply to your whole account. If one folder needs different settings, see Custom PHP settings per folder with .user.ini.

Cette page vous a-t-elle aidé ?