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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 6th September 2017, 12:19 AM
Ted Lyngmo Offline
Registered User
 
Join Date: Nov 2015
Location: Gothenburg, Sweden
Posts: 11
windows_7chrome
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:

Code:
$ 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.
Code:
# cat /etc/php.d/99-mysql.ini
; Enable legacy mysql extension module
extension=mysql.so
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:
Code:
[MySQL]
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:
Code:
$ 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.

Br,
Ted
Reply With Quote
  #2  
Old 11th September 2017, 08:02 AM
remi's Avatar
remi Offline
Registered User
 
Join Date: Sep 2004
Location: Champagne
Posts: 117
linuxfedorafirefox
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
  #3  
Old 11th September 2017, 09:37 AM
antikythera Offline
Administrator
 
Join Date: Dec 2013
Location: United Kingdom
Posts: 5,073
linuxchrome
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
  #4  
Old 21st September 2017, 10:24 AM
Ted Lyngmo Offline
Registered User
 
Join Date: Nov 2015
Location: Gothenburg, Sweden
Posts: 11
windows_7chrome
Re: Howto: WordPress 3.4.2, MySQL and PHP7

Quote:
Originally Posted by remi View Post
> 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.
Yes, I read that when trying to solve this myself but I have very limited knowledge about wordpress so I didn't dare trying to upgrade the site. Neither did I know how to make the old wordpress version use one of the new extensions replacing the mysql extension. So, the guide was written specifically for those wanting to get their old wordpress site up and running using the mysql extension.

Quote:
Using a very old wordpress 3 seems terrible strange (and unsecure)
Perhaps. In my case it's just a matter of letting the old site live for a a little longer until the new hosted one is launched.

Quote:
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)
Oh, that's nice! Will those work with F25 or F26? I noticed that the mysql.so that I compiled for F25 did not work in F26 so I had to recompile it after the upgrade to F26.

Br,
Ted
Reply With Quote
  #5  
Old 22nd September 2017, 11:39 AM
remi's Avatar
remi Offline
Registered User
 
Join Date: Sep 2004
Location: Champagne
Posts: 117
linuxfedorafirefox
Re: Howto: WordPress 3.4.2, MySQL and PHP7

> Oh, that's nice! Will those work with F25 or F26?

Of course.
__________________
Remi's Blog - Repository - Forums
Reply With Quote
Reply

Tags
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: 06:06 (Monday, 25-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

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