Replace php 7 version with php 5.4

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I was moving some sites from a server to a new one. A few sites would not work after moving them. One of them said "MySQL not supported by your PHP version". After searching, it seems to be caused by deprecated mysql extension. So I thought changing php version to same as old server would resolve this - old server php version is 5.4.45

I tried following some answers to similar questions but nothing worked. I did this one but since mysql is already deprecated in php5.6, this wouldn't fix my problem: How can I downgrade from PHP 7 to PHP 5.6 on Ubuntu 16.04?

Tried these ones also: How do I install different (upgrade or downgrade) PHP version in still supported Ubuntu release?

How to downgrade PHP from 5.5.9 to 5.4 in Ubuntu 14.04 (Installed with LAMP)

I guess that since these questions are a few years old already, resources might not be available anymore.

Can anyone tell me a way to install php 5.4 that will work in present time?

Additional info: - ubuntu 16.04

profilepic.png
manpreet 2 years ago

 

The short answer is, you don't. 5.4 is no longer supported and has known vulnerabilities that will not be fixed.

The only way it's possible is find the source and compile it yourself.

However, this is all for naught. Using sudo apt install php5.6-mysql as explained in Installing PHP 5.6 on Xenial (16.04) will get you what you need.

You need to understand that deprecated isn't the same as removed. mysql() will still work in the 5.5/5.6. It's not recommended to continue using it, but it does work, you'll just need to turn your logging down to rid yourself of the deprecation warnings.

php.ini

error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE

If you're receiving an error related to an undefined function, that means it's unable to call the function you're trying to use. In your case, it would be most likely due to missing the php5.6-mysql module.

Some basic modules you'll most likely need, in addition to php5.6-mysql is included in the following line.

sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community