• Resolved formless

    (@formless)


    First of all, thank you for your plugin.

    I made a new site on Local(by flywheel) and installed this plugin.
    And I clicked “Open Adminer in a new tab” button in plugin’s option screen, then I encountered wp_die screen saying “There has been a critical error on this website. ...” after an auto-redirection from adminer login screen.

    The error from error.log is below.

    [29-Dec-2022 02:15:23 UTC] PHP Fatal error: Uncaught TypeError: mysqli::real_connect(): Argument #5 ($port) must be of type ?int, string given in /Users/{user_id}/Local Sites/{site_dir}/app/public/wp-content/plugins/pexlechris-adminer/inc/adminer.php:1253

    My environment is here.

    • WordPress: ver. 6.1.1
    • PHP: ver. 8.0.22
    • Database Management tool – Adminer : ver 2.1.0
    • (No other plugins)

    Am I missing something to do?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pexle Chris

    (@pexlechris)

    Hi.

    I use local with php 8.0.0 and I don’t face any problem.

    In line 1253, the 5th argument is:

    (is_numeric($gg)?$gg:ini_get("mysqli.default_port"))

    Can you try to do debugging in order to solve the problem?

    Change line 1253 with this one:

    connect($M="",$V="",$F="",$j=null,$gg=null,$wh=null){global$b;mysqli_report(MYSQLI_REPORT_OFF);list($Fd,$gg)=explode(":",$M,2);$Eh=$b->connectSsl();if($Eh)$this->ssl_set($Eh['key'],$Eh['cert'],$Eh['ca'],'','');var_dump($gg);var_dump(ini_get("mysqli.default_port"));die;$I=@$this->real_connect(($M!=""?$Fd:ini_get("mysqli.default_host")),($M.$V!=""?$V:ini_get("mysqli.default_user")),($M.$V.$F!=""?$F:ini_get("mysqli.default_pw")),$j,(is_numeric($gg)?$gg:ini_get("mysqli.default_port")),(!is_numeric($gg)?$gg:$wh),($Eh?64:0));$this->options(MYSQLI_OPT_LOCAL_INFILE,false);return$I;}function
    

    and share to me the var_dumps.

    Thanks ??

    Thread Starter formless

    (@formless)

    Hi to @pexlechris

    Thank you for your cooperation, the result was this line below in my screen instead of wp_die().

    NULL string(0) ""

    (The URL is https://localhost:10110/wp-adminer?username=&db=local)

    PS
    I also tried the same with PHP 8.0.0, but I got the same error.

    Plugin Author Pexle Chris

    (@pexlechris)

    ini_get("mysqli.default_port")

    shouldn’t be empty string!! The problem is with the configuration of your installation.

    You can add the mysqli.default_port yourself in the php ini settings.

    Example here:

    https://stackoverflow.com/questions/12394104/php-connection-variables-ini-file#answer-12395483

    Thread Starter formless

    (@formless)

    @pexlechris, Thank you for your support!

    First of all, I’ve checked the result of phpinfo(), and the value of mysqli.default_port was not set.

    I am using version 6.6.0 of Local (by flywheel), and newly made Local’s site via default flow is seemingly using UNIX Socket to connect to MySQL(*) instead of TCP/IP. That’s why mysqli.default_port is not set, I assume. But still the Local’s built-in Adminer is working fine…
    *I paste the execution result of command “mysql> status” below.

    mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
    
    Connection id: 157
    Current database:
    Current user: root@localhost
    SSL: Not in use
    Current pager: stdout
    Using outfile: ''
    Using delimiter: ;
    Server version: 8.0.16 MySQL Community Server - GPL
    Protocol version: 10
    Connection: Localhost via UNIX socket
    Server characterset: utf8
    Db characterset: utf8
    Client characterset: utf8
    Conn. characterset: utf8
    UNIX socket: /Users/.../Library/Application Support/Local/run/.../mysql/mysqld.sock
    Uptime: 2 days 1 hour 33 min 33 sec

    Maybe I have to find a way to change the method of connection to TCP/IP from UNIX Socket first…

    PS
    I’ve tried your plugin on another WordPress which uses TCP/IP to connect to MySQL, and It worked fine with no additional configuration to php.ini.

    Plugin Author Pexle Chris

    (@pexlechris)

    Yes, my Plugin works with classic installations. Somethimg goes wrong with yours and I cannot help you because it is issue of server or Adminer configuration.

    Of tthe issue is from Adminer you can open a support ticket in Adminer’s Repository.

    Thanks for using my Plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Fatal error’ is closed to new replies.