AbdulBazith's avatar

Update laravel from 5.4 to newer version in live

Guys iam sticking into a problem.

i have a domain xyz.com in cpanel with version php 7.3 inherited.

i have two folders in that xyz.com.

that is xyz.com/hotel -> this is for my hotel project and xyz.com/school ->school project.

in this

xyz.com/hotel -> Laravel Framework 5.4.36 version


xyz.com/school   ->Laravel Framework 5.8.33 version


everything is fine. 2 days back i faced a problem. that images cant be uploaded in school project that is xyz.com/school in this. when i checked i saw the below error

Refer : https://imgur.com/im4ct1h

PHP Fileinfo extension must be installed/enabled to use Intervention Image

i refereed in google and i got the answer that to enable the fileinfo in cpanel. i dont have that updation in my cpanel. so chatted with my cpanel support and said them to enable the fileinfo. they made some changes in php.ini file and then informed me. now the site worked fine. images uploaded correctly.

but i faced another problem in my xyz.com/hotel project, because they changed the php version of that xyz.com to 7.3 version not inherited.

the problem i faced in xyz.com/hotel is

Refer: https://imgur.com/4uUHiY4

compact(): Undefined variable: operator


iam facing this problem when taking reports in the hotel project. but all other modules works fine. when i didnt use any comapct() variable or term related to compact in my report controller.

whats the problem????

when i googled it i found the solution that need to update laravel version more than 5.4. but how can i update my laravel version of my hotel project which is in live??

what should i do.?

when i asked my support the gave an explanation that

Now your application (xyz.com) works on 7.3 inherit
    
Now what inherit does is it takes default server values

Php 7.3 inherit takes the default settings of the server

And PHP 7.3 allows you to edit the values
So when you use 7.3 it takes the value I set in php.ini
Now if it takes the value from php.ini then your extension Fileinfo gets active
But your other website needs default configuration

So it starts to throw error
Now what you can do is.
When ever you want to upload the file
to your application.
Just temporarily change the PHP version
Upload the files
And then revert it back


the above is the explanation given by my support. i cant understand anything.

now what i thought is may be the hotel project is in lower version 5.4 so if we update that the compact error my vanish. is this right??

Kidny some one suggest an idea please.

0 likes
3 replies
siangboon's avatar
Level 54

As what i understand, even shared hosting, cPanel support multple php veresion selection, for each site you can choose any php version you need even both site siting within a same server..

howerver, don't think this suggested solution should last long... suggest that to migrate your old version to new version of laravel or move out the new laravel project to other hosting plan with a proper environment setup, stick the old one use the default setup.

saadaan's avatar

Please never upgrade the PHP version in a working environment. A whole lot will go wrong, and you will die fixing it!

COMPACT is used in controller for passing the variables to blade. If you are not passing the variables, how is your portal working? Can you please share a snapshot of the error page?

AbdulBazith's avatar

@siangboon @saadaan ya you both are right.

just i changed it into another location. than k you for your kind help. but i need to know how to upgrade laravel version when it is in live.

and if possible if you are free refer this also please.

Refer:

https://laracasts.com/discuss/channels/laravel/attendance-report-from-row-wise-in-db-to-column-wise-in-blade-file-laravel

refer:

https://laracasts.com/discuss/channels/laravel/how-toretrive-staff-designation-from-one-child-table-to-another-child-table-with-one-parent-table

Please or to participate in this conversation.