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

gulraizazam0's avatar

How To Update PHP version In laravel.

i am using laravel 5.3. i want to install package for pdf file generation. when i run the command to install package it shows error that my php version not supports this package. so how i can update the version?

0 likes
5 replies
Sergiu17's avatar

Just, uninstall PHP 5 and install PHP 7

When you run in terminal

php -v

Which version you have installed?

1 like
D9705996's avatar

@gulraizazam0 - what operating system is the server running your application using? Debian, centos, Windows?

Do you have access to administer the server or are you using shared hosting?

1 like
bobbybouwmann's avatar

Laravel 5.3 supports PHP 5.6.4 or up. So it's not your application you need to upgrade, but you need to upgrade the PHP version of your local or production environment.

If you run php --version you will see what php version you have on your server or local environment.

2 likes
D9705996's avatar

What package are trying to install? It may require a specific version of laravel, which if it's 5.7 needs php >= 7.1.3.

You might also have an older version of php in use by your webserver. In the root of your public directory add a file call phpinfo.php with these contents

<?php phpinfo(); ?>

Go to http://yoursite/phpinfo.php and see what version you are running. Delete the phpinfo.php file once your done

Please or to participate in this conversation.