When working with PHP through the command line interface (CLI), you might need to use a different PHP version than what's running on your web server. This is common when running scripts, composer commands, or cron jobs that require specific PHP features.
First, check your current CLI PHP version by running:
php -vTo change the PHP version for CLI, you have several options depending on your hosting environment:
1. Using alternatives system (Linux servers):
Many hosting providers use the update-alternatives system. You can switch versions with:
sudo update-alternatives --set php /usr/bin/php8.1
Replace "8.1" with your desired version number.
2. Creating aliases (for regular users):
Add an alias to your ~/.bashrc or ~/.bash_profile:
alias php='/usr/bin/php8.1'
Then reload with: source ~/.bashrc
3. Using absolute paths:
Simply call PHP using the full path to your desired version:
/usr/bin/php8.1 script.php
Important notes:
php -v againIf you're on shared hosting without shell access, contact your hosting provider as they may need to make this change for you.
We provide a range of scalable shared hosting solutions designed for blogs, business sites, and online portfolios. Each plan includes essential features to ensure optimal performance.
Ideal for launching a simple personal blog or a small static website to establish your initial online presence.
Starter Package
1 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety
Perfect for growing blogs or small business websites that require more storage and resources.
Growth Plan
2 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety
Suited for dynamic websites, online communities, or small online stores with moderate traffic.
Business Package
5 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety
Excellent for resource-intensive websites, medium-sized online stores, or multimedia-rich portfolios.
Professional Tier
10 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety
Designed for high-traffic business websites, extensive blogs, or e-commerce platforms with many products.
Advanced Solution
20 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety
Our most powerful shared hosting plan, built for large enterprises, major online marketplaces, and high-demand applications.
Enterprise Grade
50 GB Disk Space
Unmetered data transfer and support for multiple domains
Complimentary Let's Encrypt SSL certificate
High-performance SSD NVME storage drives
Daily automated backups for data safety