Category Archive Knowledgebase

ByJUJU-dev

PHP modules and extensions on shared hosting servers

On a shared hosting server, the availability of PHP modules and extensions can vary depending on the hosting provider and the specific plan you’re using. However, here’s a general overview of the most common PHP modules and extensions that are typically available on shared hosting servers:

PHP Core Modules

  1. ctype: Provides functions for checking and manipulating character types.
  2. date: Functions for working with dates and times.
  3. fileinfo: Provides information about file types and contents.
  4. filter: A filtering system for input data.
  5. gd: Library for image manipulation.
  6. iconv: Character set conversion functions.
  7. json: JSON encoding and decoding functions.
  8. mcrypt: Encryption and decryption functions.
  9. mysql: MySQL database extension.
  10. openssl: SSL/TLS encryption functions.
  11. pcre: Perl-compatible regular expressions.
  12. pdo: PHP Data Objects for database interactions.
  13. ** Reflection**: Object reflection and introspection.
  14. session: Session management functions.
  15. spl: Standard PHP Library for working with arrays, strings, and other data types.

Additional PHP Extensions

  1. apcu: Alternative PHP Cache Userland Extension (a caching system).
  2. curl: CURL library for transferring data over HTTP, HTTPS, FTP, etc.
  3. domxml: Document Object Model (DOM) parser for XML files.
  4. exif: EXIF metadata reader and writer for images.
  5. fannypdf: PDF generation and manipulation library.
  6. ftp: FTP client library.
  7. gd2: Image manipulation library (successor to gd).
  8. imagick: ImageMagick library for image manipulation.
  9. ioncube_loader: IonCube loader for encoded PHP code.
  10. mhash: Message-Digest Algorithm 5 (MD5) hash functions.
  11. oci8: Oracle Database extension.
  12. pgsql: PostgreSQL database extension.
  13. soap: SOAP web services extension.
  14. wddx: WDDX (Web Distributed Data Exchange) serialization format.

Third-Party Extensions

Many third-party extensions are also available, which can be installed manually or through the cPanel control panel’s “PHP Select Python” interface:

  1. Xdebug: A debugging extension for PHP code.
  2. XCache: A caching system for improving performance.
  3. Zend Guard: An obfuscation tool for protecting PHP code.

Keep in mind that not all hosting providers may have all these extensions available, so it’s essential to check with your hosting provider to see which ones are supported on your specific plan.

If you need a specific extension not listed here, you can try contacting your hosting provider to see if they can install it for you or recommend an alternative solution.

ByJUJU-dev

How to change PHP version on shared servers

Changing PHP version on a shared server can be a bit tricky, but it’s doable. Here’s a step-by-step guide to help you through the process:

Before you begin:

  1. Check if you have access: Make sure you have the necessary permissions and access to modify the server configuration.
  2. Check the hosting provider’s documentation: Familiarize yourself with your hosting provider’s documentation on how to change PHP versions.

Method 1: Using cPanel (if available)

  1. Log in to your cPanel account.
  2. Click on the “Software” section and select “MultiPHP Manager”.
  3. Click on the “Select PHP Version” dropdown menu and choose the desired PHP version from the list.
  4. Click “Update” to apply the changes.
  5. Restart your website or reload the page to ensure the changes take effect.

Method 2: Using .htaccess file (if cPanel is not available)

  1. Log in to your file manager (e.g., FileZilla) and navigate to your website’s root directory.
  2. Open the .htaccess file and add the following lines at the end:
<IfModule mod_php7.c>
    PHPIniDir /path/to/php.ini
</IfModule>

<IfModule mod_php8.c>
    PHPIniDir /path/to/php8.ini
</IfModule>

Replace /path/to/php.ini and /path/to/php8.ini with the actual paths to your PHP configuration files.

Method 3: Using SSH (if you have SSH access)

  1. Connect to your server using SSH.
  2. Navigate to your website’s root directory using the command cd /path/to/website.
  3. Create a new file called php.conf with the following contents:
<?php
php_flag[display_errors] = On
php_value[error_reporting] = E_ALL
?>

This sets PHP’s error reporting level to E_ALL and displays errors. 4. Save the file and then update the Apache configuration by running:

sudo /usr/local/apache/bin/apachectl restart

This restarts Apache and applies the changes.

Verify PHP version

To verify that you have successfully changed the PHP version, you can use one of the following methods:

  1. Check your website’s phpinfo() function: Create a new file with a .php extension (e.g., info.php) and add the following code:
<?php phpinfo(); ?>

Open this file in a web browser to see the PHP information, including the version. 2. Check your hosting provider’s control panel: If you’re using a control panel like cPanel, you can check the PHP version from there.

Remember to always test your website after changing PHP versions to ensure everything is working as expected.

Keep in mind that changing PHP versions can affect your website’s functionality, so be cautious when making these changes, especially if you’re not familiar with PHP or have a complex setup.