FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2015
    Location
    Gothenburg, Sweden
    Posts
    35

    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

  2. #2
    Join Date
    Sep 2004
    Location
    Champagne
    Posts
    120

    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)
    Last edited by remi; 11th September 2017 at 08:08 AM. Reason: typo

  3. #3
    Join Date
    Dec 2013
    Location
    United Kingdom
    Posts
    5,226

    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

  4. #4
    Join Date
    Nov 2015
    Location
    Gothenburg, Sweden
    Posts
    35

    Re: Howto: WordPress 3.4.2, MySQL and PHP7

    Quote Originally Posted by remi
    > 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.

    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.

    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

  5. #5
    Join Date
    Sep 2004
    Location
    Champagne
    Posts
    120

    Re: Howto: WordPress 3.4.2, MySQL and PHP7

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

    Of course.

Similar Threads

  1. Apache PHP7 fedora 25 DOES NOT WORK!!
    By filmat in forum Servers & Networking
    Replies: 2
    Last Post: 13th June 2017, 08:08 AM
  2. Replies: 1
    Last Post: 27th October 2011, 09:54 AM
  3. Wordpress + Apache,PHP,MySQL
    By gripek in forum Using Fedora
    Replies: 1
    Last Post: 25th July 2009, 05:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •