Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-08-26 19:50:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

PHP 7: Call to undefined function mysql_connect()

If you’re getting the following error when running the setup after installing Textpattern, your server has PHP version 7 (or higher) installed, which no longer has support for the old mysql extension (used by textpattern until at least version 4.5.7).

Checking database connection

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/textpattern-4.5.7/textpattern/setup/index.php:300

Stack trace:

  1. /var/www/html/textpattern-4.5.7/textpattern/setup/index.php(99): printConfig()
  2. {main} thrown in /var/www/html/textpattern-4.5.7/textpattern/setup/index.php on line 300

There are two ways to solve this:

  1. upgrade Textpattern to a more recent version (such as TXP 4.6), assuming it is available when you read this (recommended)
  2. ask your webhost to downgrade PHP to a version lower than 7 (not recommended)

Offline

#2 2015-08-27 10:50:36

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: PHP 7: Call to undefined function mysql_connect()

Well, that’s convenient. Most hosts will likely be upgrading PHP sooner than later, not downgrading, which might mean some version of 4.6 should come sooner than later too. There are enough little changes to make it worthwhile, I think, and add this reason to the lot.

Last edited by Destry (2015-08-27 11:16:30)

Offline

#3 2015-08-27 11:17:12

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: PHP 7: Call to undefined function mysql_connect()

Destry wrote #294382:

Well, that’s convenient. Most hosts will likely be upgrading PHP sooner than later, not downgrading, which might mean some version of 4.6 should come sooner than later too. There are enough little changes to make it worthwhile, I think, and add this reason to the lot.

+1


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2015-08-27 11:48:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: PHP 7: Call to undefined function mysql_connect()

PHP7 release is scheduled on nov 12th 2015.

Offline

#5 2015-09-01 21:15:10

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: PHP 7: Call to undefined function mysql_connect()

Dreamhost sent me an e-mail the other day:

Starting on November 3, 2015, we will begin automatically updating domains from PHP 5.3 and PHP 5.4 to PHP 5.5. You will get an email when the update is complete.

We’re updating PHP because:
- PHP 5.3 has already been End-Of-Lifed (EOL’ed), which means the product is no longer receiving security updates from the developers at PHP.net.
- PHP 5.4 will EOL later this year.
- PHP 5.5 is well tested, stable, and has been in production since June 2013.
- PHP 5.6 is well tested, stable, and has been in production since August 2014. You can check out all the cool features on our wiki.

Most sites should update just fine from PHP 5.3 or PHP 5.4 to PHP 5.5. However, there are some cases where sites can break — usually from custom or third-party scripts, or from using out of date 1-Click Installs. Our wiki has all the details.

5.6 is actually the latest version available and is the default for a new setup.

Offline

#6 2016-01-13 20:57:03

zbs
New Member
Registered: 2016-01-13
Posts: 1

Re: PHP 7: Call to undefined function mysql_connect()

Does TXP 4.5.7 work on PHP7?

I’m getting this error and mysql_connect() does not seem to be simply replaceable with mysqli().

Offline

#7 2016-01-13 21:28:12

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: PHP 7: Call to undefined function mysql_connect()

No, but it will with Txp 4.6, which is expected to be released in the near future. (I don’t know when, exactly.)

Offline

#8 2016-03-01 12:58:53

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: PHP 7: Call to undefined function mysql_connect()

Just as an fyi/fwiw

Dreamhhost announced this morning that PHP 7 is now available as an option. They consider it in “beta” for their support purposes.

They (correctly) list their one click install of Textpattern as incompatible.

When 4.6.x is released, it would be a good time to have them update their one click install version.

Offline

#9 2016-04-19 14:50:18

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: PHP 7: Call to undefined function mysql_connect()

I was working on a site today on Dreamhost and upgraded everything.

Textpattern version: 4.6-dev (e2715e671d1f074ca73539ab35c05ba4)
Last update: 2016-04-19 13:56:44/2016-04-19 13:55:55
PHP version: 7.0.4
GD Graphics Library: bundled (2.1.0 compatible); supported formats: GIF, JPG, PNG.

I haven’t noticed any issues so far.

Offline

#10 2016-04-20 08:30:22

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: PHP 7: Call to undefined function mysql_connect()

Ubuntu 16.04 LTS will likely hit the streets tomorrow and has PHP7 included: wiki.ubuntu.com/XenialXerus/ReleaseNotes#PHP_7.0

Offline

#11 2016-04-20 08:51:01

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: PHP 7: Call to undefined function mysql_connect()

I moved a Textpattern site to a new host yesterday which is running PHP 7.0.1 – all working fine with latest 4.6dev (and is noticeable faster). I did have a couple of weird bits of PHP output on the prefs page while changing some prefs but that is gone now and the prefs have all saved fine – I haven’t been able to replicate that again either.

Offline

Board footer

Powered by FluxBB