Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tariq_jubair's avatar

PHP Dependency Error in cPanel: Laravel 9

Hi guys, i am new to Laravel and working in a project where i have used Laravel 9 with PHP 8.1.0. In localhost it works fine, i have used most common packages and payment gateways. Everything seems fine. I have deployed this in client hosting (from Namecheap) with and used common php 8.1 from cPanel PHP manager. It seems working good.

The problem is when i deployed same project in my personal hosting, i have found that it only have option upto PHP 8.0. It's showing PHP dependency error that i need to upgrade it in 8.1 or greater. I communicated with hosting support, they suggested to use Multi PHP Manager app and use 8.1/8.2 PHP version for that single subdomain.

Which i did but whenever i applied the setting, it's showing 'Page not working' or 'Forbidden 403' error. I tried uploading files multiple times, uploaded .env or .htaccess again but same. If i select PHP 8.0 or lower from multi PHP manager, it's showing same old PHP dependency error. I have checked/searched for common solutions like changing composer.json to ignore checking PHP version or changing version directly or tried downgrading php dependency from terminal/Git. But none seems to be working from cPanel. Can you please help me finding the issue or how to overcome this?

Note: I have used stripe and other compulsory packages that needs PHP 8.1 at least. If i downgrade PHP it would crash and i cannot take the chance. Is there any guideline about this, so that i can have the full idea? Thanks in advance.

0 likes
7 replies
abd_wazzan's avatar

Can you explain how did you change the PHP version?

abd_wazzan's avatar

@tariq_jubair forget that you have a laravel project for a second, upload an index.php file that will echo the PHP info

<?php
phpinfo();
?>

that way you will make sure what is the running PHP version. In my personal opinion, I do not think it is a PHP version problem. but after you make sure we can think about it.

tariq_jubair's avatar

@abd_wazzan, sorry for late response. Here is the screenshot, it says PHP 8.0.25 for subdomain. <img src= "https://drive.google.com/file/d/1ZfF6DwZn-IS8nt1Jh0ef84BfC9zBgxZb/view?usp=sharing">

Later hosting support ensured they enabled PHP 8.1 now, so i checked again, it still showing phpinfo as same PHP 8.0.25. But when i tried from terminal it's showing it changed to 8.1.1. And suddenly my project is live again! <img src= "https://drive.google.com/file/d/1qKY0XGMcHypKbc6TC-UlQ5hQQdc2HqNl/view?usp=sharing">

I am still not clear why they are showing different PHP versions (terminal & phpinfo.php), but the issue seems to be resolved. I'd be grateful if you can share any links or message about any proper guideline to avoid this type of dependency errors in future. Thanks so much.

1 like
abd_wazzan's avatar

@tariq_jubair good to know that it is resolved, note that the CLI PHP version can be different from the apache and that causes most of the problems if you were not careful because you may use some PHP artisan commands. These will be executed using the CLI PHP version, and an exception can happen here if the CLI PHP version were not compatible with your application.

Please or to participate in this conversation.