Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (Not For Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (Not For Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Thread Tools Search this Thread Display Modes
Old 6th September 2017, 12:19 AM
Ted Lyngmo Offline
Registered User
Join Date: Nov 2015
Location: Gothenburg, Sweden
Posts: 9
Howto: WordPress 3.4.2, MySQL and PHP7

If you've upgraded from Fedora 24 to something newer you may have noticed that the included php version no longer supports MySQL connections. This is troublesome if you are also hosting an old version of WordPress. Here's how I managed to solve that.

Download, build and install the shared library module needed for PHP7 to be able to do MySQL connections:

$ sudo dnf install php-devel
$ git clone https://github.com/php/pecl-database-mysql mysql --recursive
$ cd mysql
$ phpize
$ ./configure
$ make
$ sudo cp modules/mysql.so /usr/lib64/php/modules
Make sure the module is loaded after mysqlnd.so by creating an ini file with a larger number than mysqlnd.so's ini file.
# cat /etc/php.d/99-mysql.ini
; Enable legacy mysql extension module
Add a MySQL entry in /etc/php.ini if it's not already there. Copy your old entry if you've saved the old file or add this:
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
Restart your webserver:
$ sudo systemctl restart httpd.service
PHP7 should now be able to use MySQL.

If you did this to get an old WordPress installation to work, you now need to watch the webservers error log (/var/log/httpd/error_log). I found that many classes in plugins had overridden base class methods but using an incorrect signature for the methods. I simple copied the signatures from the base classes and put them in the derived classes one by one when seeing them in the error log.

Some plugins also had logic errors that required some thinking, like "continue" or "break" when there was nothing to continue or break from. Older php versions probably just ignored those statements but php7 refuses to execute files with those kinds of errors. All in all, it took an hour to correct the problems in the plugins used.

Reply With Quote
Old 11th September 2017, 08:02 AM
remi Offline
Registered User
Join Date: Sep 2004
Location: Champagne
Posts: 116
Re: Howto: WordPress 3.4.2, MySQL and PHP7

> If you've upgraded from Fedora 24 to something newer you may have noticed that the included php version no longer supports MySQL connections.

If does using the mysqli extension or pdo_mysql PDO driver.

Only the old deprecated mysql extension is deprecated and have been removed.

And Wordpress recent versions use the mysqli extension.

Using a very old wordpress 3 seems terrible strange (and unsecure)

If really needed, for some other legacy application, RPM of the OLD DEPRECATED UNSUPPORTED mysql extension are availalble in my repository: https://rpms.remirepo.net/ (php-pecl-mysql package)
Remi's Blog - Repository - Forums

Last edited by remi; 11th September 2017 at 08:08 AM. Reason: typo
Reply With Quote
Old 11th September 2017, 09:37 AM
antikythera Offline
Join Date: Dec 2013
Location: United Kingdom
Posts: 5,070
Re: Howto: WordPress 3.4.2, MySQL and PHP7

thanks remi for contributing to the thread and for your repository. I use it myself for a couple of other packages
Download, Install and Share Fedora - Official ISO Torrents | Live ISO Respins containing post-release updates
Reply With Quote

howto, mysql, php7, wordpress

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache PHP7 fedora 25 DOES NOT WORK!! filmat Servers & Networking 2 13th June 2017 08:08 AM
problem setting up wordpress mysql database with fedora 15 bplv1013 Using Fedora 1 27th October 2011 09:54 AM
Wordpress + Apache,PHP,MySQL gripek Using Fedora 1 25th July 2009 05:48 AM

Current GMT-time: 12:45 (Wednesday, 20-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat