How to Create a Dynamic Select2 Dropdown with Laravel and AJAX
Read More
Updating PHP and Composer versions on Hostinger using SSH CLI can be challenging, especially without sudo
access. This guide simplifies the process and ensures you can work seamlessly within the limitations of shared hosting environments.
When using Hostinger's shared hosting, you may encounter restrictions that prevent direct updates to software like PHP and Composer. By leveraging SSH and local configurations, you can still update these tools effectively. This guide will walk you through updating PHP and Composer step by step.
Hostinger provides multiple PHP versions that can be selected through custom configuration. Follow these steps to update PHP:
Run the following command to check the current PHP version:
To use a newer version of PHP (e.g., PHP 8.2):
Open your .bashrc
file to set a new alias:
Add or update the alias for PHP:
Save the file and reload it:
Verify the updated PHP version:
If the output shows PHP 8.2 (or your desired version), the update was successful.
Composer is an essential tool for managing dependencies in PHP projects. Follow these steps to update Composer to the latest version:
Run the following command to download the latest Composer installer:
This command downloads the composer.phar
file to your current directory.
Create a bin
directory in your home folder if it doesn’t exist:
Move composer.phar
to the bin
directory:
Open your .bashrc
file:
Add the following line to include ~/bin
in your PATH:
Save the file and reload the shell configuration:
Verify the Composer version:
If the output shows the latest version, Composer has been successfully updated.
If PHP does not update:
Ensure the alias points to the correct path (e.g., /opt/alt/php82/usr/bin/php
).
Check the active PHP binary using:
If Composer fails to execute:
Verify the composer
file has execute permissions:
Ensure ~/bin
is in your PATH.
By following this guide, you can seamlessly update PHP and Composer versions on Hostinger using SSH CLI without needing sudo
access. This approach empowers developers to maintain an up-to-date development environment even in shared hosting scenarios.
Yes, you can use Hostinger’s control panel to switch PHP versions without SSH access.
Composer updates improve performance, add features, and ensure compatibility with modern PHP versions and packages.
curl
installed?You can use wget
as an alternative to download the Composer installer:
Keep your tools updated for better performance and compatibility! If you face any issues, let us know in the comments below.
Recent posts form our Blog
0 Comments
Like 0