Error after using php 7

Error after using php 7

by m question -
Number of replies: 5

Hi,

I am using Moodle 3.1.we updated server to PHP 7 so we can use 3.5 next semester.

however, when I log to Moodle (3.1) I have the following error

Exception - Call to undefined function odbc_connect() moodle

how to solve it, currently I get back to php 5.6 and it worked

Average of ratings: -
In reply to m question

Re: Error after using php 7

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Firstly, do you mean that you installed PHP 7.0?  7.1 and newer is not supported by Moodle 3.1

https://docs.moodle.org/dev/Moodle_3.1_release_notes#Server_requirements

Having said that, odbc_connect() is not dependent on any of those versions. It simply sounds as though it was missing in your build of PHP 7. 

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Error after using php 7

by m question -
Yes I installed PHP 7.0.3

I want to still use older moodle for past semesters and also the new one (Moodle 3.5)



In reply to m question

Re: Error after using php 7

by Ken Task -
Picture of Particularly helpful Moodlers

Think, then, one will have to set up server to use multiple versions of PHP.   How to do that depends upon platform and could be tricky - 'involved'.

Example:

https://www.tecmint.com/install-different-php-versions-in-ubuntu/

'spirit of sharing', Ken



In reply to Ken Task

Re: Error after using php 7

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You can run Moodle 3.1 and 3.5 on PHP 7.0.3

I don't think the issue here is the version. It's a problem in the build or a missing extension (depending on how it was installed)

In reply to m question

Re: Error after using php 7

by Ken Task -
Picture of Particularly helpful Moodlers

Have a CentOS 7 system that is running Moodle 3.1.x and a Moodle 3.5.1 with PHP 7.0.25 right now without errors you've shared here.

What platform is your Moodle running upon?

IMHO, to avoid complications that one would create if successful in getting multple PHP versions running on one server for different versions of Moodle would have to be 'undone' in a short time frame. 

Shouldn't leave the older versions of anything up and running ... and accessible ... remember, it's accessible to all on the internet ... good guys as well as the bad guys (and, BTW, I don't practice what I preach with 'sandboxes' ... but I do monitor and protect those older instances as long as it doesn't get to be too much work!)

Therefore (IMHO), the easiest/wisest option is to spin up a new server for 3.5.x -> ... that one moves forward.   Easy enough to do *IF* one has internal virtualization ability ... or can afford a remotely hosted VPS setup with any number of providers.

2 cent opinion ...

'spirt of sharing', Ken