Monthly Archive October 17, 2018

ByJUJU-dev

How to install Composer on shared servers

How to install Composer on shared servers

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on, and it will manage (install/update) them for you. Composer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with ‘packages’ or libraries, but it manages them on a per-project basis, installing them in a directory (e.g., vendor) inside your project. By default, it will never install anything globally. Thus, it is a dependency manager.

To install Composer:

1. SSH access should be enabled for your hosting account with us. Follow the steps provided in this article to switch SSH access on.

2. To access your account via SSH, download and install one of the available SSH clients. You can find the list of free SSH clients here. In case you are using a Unix-based OS (Linux or OSX), you can easily run the Terminal application and connect to the server using the command:

ssh username@servername -pPORT

ssh – command for logging into the remote server
username – your cPanel username
servername– name of the server where your hosting account is located (you can find it using this tutorial)
PORT – connection port – 21098 for a Shared Hosting servers, 22 – for a VPS/Dedicated server 

3. Open your SSH client, put your domain name or the IP address of the server into the Host Name field, enter 21098 or 22 into the Port field, choose SSH as your connection type and press the Open button:

How to install Composer on shared servers
4. If you receive PuTTY Security Alert, press Yes:
How to install Composer on shared servers

When prompted, enter your cPanel username and password (when you enter the password, it is automatically hidden for security purposes):

How to install Composer on shared servers

5. Composer requires PHP 5.5+ version, so we need to check whether the needed version is set up. Type the php -v command in PuTTY (or in Terminal) and you will get the following output:

How to install Composer on shared servers

6. If you need to change PHP version, log in to your cPanel, navigate to Software and Services section >> Select PHP Version menu:

How to install Composer on shared servers

7. Select 5.5-7.2 version from the drop-down menu and then click on the Set as current button:

How to install Composer on shared servers

NOTE: Composer requires allow_url_fopen. It is enabled by default for all php versions on our shared servers. Still, you may check if it is On by going to Switch to PHP Settings in Select PHP version menu:

How to install Composer on shared servers

You can also find additional information about PHP selector here.

8. Next, navigate to the folder you want to install Composer in. In our example, we will install Composer in public_html:

cd public_html

How to install Composer on shared servers

9. Now, you will need to find or create the php.ini file and some values to it. Log in to cPanel and navigate File Manager menu:

How to install Composer on shared servers

10. Go to the folder your Composer will be installed in and create a new file named php.ini using the +File button:

How to install Composer on shared servers

11. Open it by right-clicking the created php.ini file >>  Edit:

How to install Composer on shared servers

12. Then add the following values to the file and hit the Save Changes button:

max_execution_time = 300
max_input_time = 300
memory_limit = 512M
suhosin.executor.include.whitelist = phar
detect_unicode = Off

How to install Composer on shared servers

13. When all the preparations are done, you are ready to install Composer. Open PuTTY window where you have logged into your cPanel account and fill in the following command:

php -r “readfile(‘https://getcomposer.org/installer’);” | php -c php.ini

This will execute the Composer installation:

How to install Composer on shared servers

To run composer commands use:
php composer.phar

How to install Composer on shared servers

In case you get a notification Some settings on your machine make Composer unable to work properly, make sure that the PHP version is 5.5 or higher and all the changes in the php.ini file are saved.

 

ByJUJU-dev

How to Connect to cPanel on Mobile Devices

How to Connect to cPanel on Mobile Devices

The cPanel app allows you to connect to your cPanel and WHM accounts on-the-go using your mobile device.

Its main features are:

  • Access to the three core cPanel services (WHM, cPanel, and WebMail)
  • Fingerprint, passcode, or pattern login to verify your identity
  • Mobile-optimized interface to let you perform hosting tasks
  • Management of multiple connections

The cPanel app is available from the Google Play Store and iOS App Store.
For the purposes of this article, we’ll describe the cPanel App for Android. The steps are the same for both systems, though the interfaces may look slightly different.

To connect with the app, you will need:

  • The cPanel/WHM username and password included in Your Hosting Welcome Guide. If you don’t have those details or don’t remember your cPanel/WHM password, a member of our Support Teamwould be happy to resend the email or help you reset your password
  • Server hostname – the name of the server on which your hosting account is located. This can be obtained either in Your Hosting Welcome Guide in the Hosting package details section or via cPanel >> Server information.

To install the app:

1. Go to the Google Play Store on your Android device, search for cPanel, and click Install:
2. Once installed, open the app. Click on the Plus button to add a new account:

3. Enter the connection details as follows:

Server information:

  • Name: any name you chose
  • Addressserver hostname (or the domain name, if it is pointing to the hosting account)
  • Service: select cPanel or WHM

Authentication:

  • Username: your cPanel/WHM username
  • Password: your cPanel/WHM password
  • EasyLogin: This allows you to use either password, PIN-code, pattern, or a fingerprint instead of your username and password for faster login.
4. Once you fill in all the details, tap Connect.

5. After the connection is established, you will be taken to the main cPanel/WHM dashboard:

 

To log into the cPanel/WHM account you added earlier, open the cPanel app and select the account name. Log in with the login method (PIN, pattern, etc.) set for the account.

From the app’s main window, you can also modify the account settings by pressing the three horizontal dots:
That’s it!
ByJUJU-dev

How to change contact information in cPanel

How to change contact information in cPanel

cPanel has its own settings regarding a user’s contact information and user notification.

By default, the email associated with cPanel is the one that was used with the cPanel account creation. If you have a Shared Hosting account, that means it will use the email associated with your JujuHost account. However, it’s possible to change the cPanel contact email at any time.

The contact email address of cPanel is used for:

  • cPanel password reset requests
  • cPanel password change notifications
  • cPanel security notifications
  • SSL certificate’s expiration notifications
  • cPanel resources limit warnings
  • new cPanel logins notifications
  • two-factor authentication settings

It’s also possible to have two contact email addresses for one cPanel at the same time.

Below you can find the steps on how to change the Contact Email address for cPanel.

 

For cPanel Basic Theme:

    1. Log in to your cPanel.
    2. Locate the “Preferences” section. By default, it is located on the lower side of your cPanel settings.
    3. Select the “Contact Information” menu:

How to change contact information in cPanel

    1. The primary email address can be edited in the top row and a secondary email address can be added in the second row. Both email addresses will be used for the notifications:

How to change contact information in cPanel

    1. This menu allows you to set the notification preferences using check marks.
    2. After editing the contact mailboxes and preferences, click the “Save” button:

How to change contact information in cPanel

  1. Done! cPanel Your contact email has been updated.
 
NOTE: cPanel contact information changes are applied instantly.

For cPanel Retro Theme:

    1. Log in to your cPanel.
    2. Locate the “Preferences” section. By default, it is located on the lower side of your cPanel settings.
    3. Select the “Contact Information” menu:

How to change contact information in cPanel

    1. The primary email address can be edited in the top row and a secondary email address can be added in the second row. Both email addresses will be used for the notifications:

How to change contact information in cPanel

    1. This menu allows you to set the notification preferences using check marks.
    2. After editing the contact mailboxes and preferences, click the “Save” button:

How to change contact information in cPanel

  1. Done! cPanel Your contact email has been updated.
 
NOTE: cPanel contact information changes are applied instantly.
ByJUJU-dev

How to check PHP version and configuration

How to check PHP version and configuration

There are two ways to check PHP version set for the account. By default, we have PHP 5.6 set on our shared servers.
To check what PHP version is selected for your account go to cPanel Software section > Select PHP version menu:

How to check PHP version and configuration
You will see the current PHP version above PHP extensions:

How to check PHP version and configurationAnother way to check PHP version is PHPinfo() function, commonly used to check the current state of PHP configuration. It can also be used for debugging purposes as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.

for cPanel Basic theme:

1. Log into your cPanel account, go to Files section > File Manager menu:

How to check PHP version and configuration

2. Navigate to public_html directory, click on New File and create a phpinfo.php file:

How to check PHP version and configuration

How to check PHP version and configuration

3. Find the newly created file in the list and click on Code Editor:

How to check PHP version and configuration

4. Add the lines of the code provided below to the file and click on Save Changes:

<?php
phpinfo();
?>

How to check PHP version and configuration

5. To see the detailed information about PHP configuration of your account, open http://yourdomain.com/phpinfo.php link in your browser, replacing yourdomain.com with your main domain name.

NOTE: For security reasons, do not forget to delete the file once you check all the necessary information.

for cPanel Retro theme:

1. Log into your cPanel account, go to the section Files File Manager menu:

How to check PHP version and configuration

2. Navigate to the public_html directory, click on New File and create a phpinfo.php file:

How to check PHP version and configuration

3.Find the newly created file in the list and click on Code Editor:

How to check PHP version and configuration

4. Add the lines of the code provided below to the file and click on Save Changes:


<?php
phpinfo();
?> 

How to check PHP version and configuration

5. To see the detailed information about PHP configuration of your account, open http://yourdomain.com/phpinfo.php link in your browser, replacing yourdomain.com with your main domain name.

NOTE: 
For security reasons, do not forget to delete the file once you check all the necessary information.

That’s it!

ByJUJU-dev

How to edit php.ini on Shared servers

How to edit php.ini on Shared servers

This guide describes how to edit the php.ini file on shared servers (Stellar and Stellar Plus plans, as well as old Value, Professional, and Ultimate plans).

If your account is hosted on the Business server (Stellar Business or old Business SSD plans), use this guide.
With the help of PHP Selector implemented on our Shared Hosting servers, you can easily modify basic PHP settings via your cPanel >> the Software section >> Select PHP Version menu. You can find detailed guidelines here.

 

However, advanced PHP settings are missing from the Select PHP Version tool and must be manually configured in the php.ini file. You can either create the file or upload the existing one to your account.

How to create a php.ini file

How to upload and edit an existing php.ini file

How to create a php.ini file

1. Log into your cPanel account, go to the Files section >> the File Manager menu.

For cPanel Basic Theme:

 

How to edit php.ini on Shared servers

For cPanel Retro Theme:

How to edit php.ini on Shared servers

2. Navigate to the root directory of the domain, click on New File, and create a file named php.ini:

How to edit php.ini on Shared servers

3. Find the newly created file in the list, right-click, and choose Edit:

How to edit php.ini on Shared servers

4. Add the required PHP settings and click on Save Changes in the top right corner:

How to edit php.ini on Shared servers

When all updates are completed, make sure to add lsapi_phpini directive.
To check the current PHP version and configuration, refer to this article.If you wish to change values for the PHP settings (e.g., max_execution_timememory_limitpost_max_sizeupload_max_filesize, etc.), you must reset the values in the Select PHP version menu. This way, it will be possible to overwrite PHP settings using php.ini.1. Log into your cPanel account, go to Software section >> Select PHP version menu.For cPanel Basic Theme:

How to edit php.ini on Shared servers

For cPanel Retro Theme:

How to edit php.ini on Shared servers

2. Go to the Switch to PHP Options menu:

3. Reset the option in question:

4. You may then apply changes to the required value in the php.ini file:

How to upload and edit an existing php.ini file

1. Log into your cPanel account, go to the Files section >> the File Manager menu.

For cPanel Basic Theme:

For cPanel Retro Theme:

2. Navigate to the root directory of the domain name in question, upload the php.ini file that corresponds to your current PHP version. Feel free to download php.ini for different PHP versions below in the Attachments section at the end of the guide.

3. Once done, use the Extract option:

4. After that, right-click on php.ini.txt to Rename it php.ini, then another right-click to use the Edit option:

5. Here, you can use the search option and find the needed limit or value. In this example, it is upload_max_filesize.

 

6. Once all the required changes are made, click Save.

In order for the php.ini to work, add lsapi_phpini directive.

That’s it!

ByJUJU-dev

LSPHP directive for php.ini on shared servers

The LSPHP directive is a powerful tool for managing PHP versions on shared servers. Here’s what you need to know:

What is LSPHP?

LSPHP (Linux Shared PHP) is a module that allows you to manage multiple PHP versions on a single server, giving you more flexibility and control over your PHP configurations.

How does LSPHP work?

LSPHP creates a separate PHP-FPM (FastCGI Process Manager) instance for each PHP version, allowing you to run multiple PHP versions simultaneously. This enables you to switch between different PHP versions for different domains or subdomains.

Configuring LSPHP

To configure LSPHP, you’ll need to edit the php.ini file and add the following directives:

[lsphp]
; Set the PHP version
php_version = 7.4

; Set the document root for this PHP version
document_root = /path/to/document/root

; Set the socket file for this PHP-FPM instance
listen = /path/to/socket/file

; Set the user and group for this PHP-FPM instance
user = username
group = groupname

Replace php_version with the desired PHP version (e.g., 7.4, 7.3, or 5.6), and document_root with the path to your website’s document root.

Enabling LSPHP

To enable LSPHP, add the following line to your httpd.conf file (or apache2.conf on Ubuntu-based systems):

Include /path/to/lsphp.conf

Restart Apache

After making changes to the configuration files, restart Apache to apply the changes:

sudo service apache2 restart

Switching between PHP versions

To switch between PHP versions, simply update the php_version directive in your php.ini file and restart Apache.

For example, if you want to switch from PHP 7.4 to PHP 7.3:

[lsphp]
php_version = 7.3

Then, restart Apache:

sudo service apache2 restart

Tips and considerations

  • Make sure to update the php.ini file for each domain or subdomain that requires a specific PHP version.
  • You can have multiple LSPHP instances running on the same server, allowing you to run different PHP versions for different domains or subdomains.
  • Be cautious when updating the php.ini file, as it can affect all domains or subdomains using that PHP version.
  • If you’re not familiar with LSPHP configuration, consider consulting your hosting provider’s documentation or seeking assistance from their support team.

By mastering LSPHP, you can gain more control over your PHP configurations and take advantage of the latest features and security patches.

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.