Discover Centmin Mod today
Register Now

PHP-FPM mysqli_query The file '/var/lib/mysql/xxx must be in the database directory or be readable by all

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by FAPM, Jan 19, 2016.

  1. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    Hi ALL,

    At the execution of a PHP script, I encounter the following error :


    mysqli_query The file '/var/lib/mysql/xxx must be in the database directory or be readable by all

    An idea ?

    Thank ALL :)
     
  2. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    On Centminmod 1.2.3-eva2000.08 / 10.0.23-MariaDB / PHP version: 7.0.2 / nginx/1.9.9
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,417
    12,256
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,837
    Local Time:
    6:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what script ?

    no php script should be directly trying to access the actual mysql database data files or directories and risk corrupting the mysql databases !
     
  4. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    Hi
    Script php (fopen) et load data infile
     
  5. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    LOAD DATA INFILE => LOAD DATA LOCAL INFILE

    now, The used command is not allowed with this MariaDB version :)
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,417
    12,256
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,837
    Local Time:
    6:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    a security measure in /etc/my.cnf comment out
    Code:
    local-infile=0
    and restart mysql
     
    Last edited: Jan 19, 2016
  7. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    local-infile=1

    mysqlrestart

    Now : open_basedir restriction in effect

    Centminmiod don't like my script :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    55,417
    12,256
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,837
    Local Time:
    6:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  9. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    10:59 AM
    1.9.2
    10.0.20
    Yes :) Thank Eva ;)