PHP 7 RC3: How to install missing MySQL PDO

后端 未结 12 915
暗喜
暗喜 2020-12-04 11:54

I am trying to setup webserver with PHP 7 RC3 + Nginx on Ubuntu 14.04 (for test purposes).

I installed Ubuntu in Vagrant using

12条回答
  •  孤街浪徒
    2020-12-04 12:22

    I'll start with the answer then context NOTE this fix was logged above, I'm just re-stating it for anyone googling.

    1. Download the source code of php 7 and extract it.
    2. open your terminal
    3. swim to the ext/pdo_mysql directory
    4. use commands:

      phpize

      ./configure

      make

      make install (as root)

    5. enable extension=mysqli.so in your php.ini file

    This is logged as an answer from here (please upvote it if it helped you too): https://stackoverflow.com/a/39277373/3912517

    Context: I'm trying to add LimeSurvey to the standard WordPress Docker. The single point holding me back is "PHP PDO driver library" which is "None found"

    php -i | grep PDO                                                                                  
    PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_odbc' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP Warning:  Module 'mysqli' already loaded in Unknown on line 0
    PDO
    PDO support => enabled
    PDO drivers => sqlite
    PDO Driver for SQLite 3.x => enabled
    

    Ubuntu 16 (Ubuntu 7.3.0)

    apt-get install php7.0-mysql
    

    Result:

    Package 'php7.0-mysql' has no installation candidate
    

    Get instructions saying all I have to do is run this:

    add-apt-repository -y ppa:ondrej/apache2
    

    But then I get this:

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 223: ordinal not in range(128)
    

    So I try and force some type of UTF: LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/apache2 and I get this: no valid OpenPGP data found.

    Follow some other instructions to run this: apt-get update and I get this: Err:14 http://ppa.launchpad.net/ondrej/apache2/ubuntu cosmic/main amd64 Packages 404 Not Found Err:15 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages 404 Not Found and - I think because of that - I then get:

    The repository 'http://ppa.launchpad.net/ondrej/apache2/ubuntu cosmic Release' does not have a Release file.
    

    By this stage, I'm still getting this on apt-get update:

    Package 'php7.0-mysql' has no installation candidate.
    

    I start trying to add in php libraries, got Unicode issues, tried to get around that and.... you get the idea... whack-a-mole. I gave up and looked to see if I could compile it and I found the answer I started with.

    You might be wondering why I wrote so much? So that anyone googling can find this solution (including me!).

提交回复
热议问题