• Resolved stefanoste

    (@stefanoste)


    It seems that NF doesn’t work with unix socket to access the DB on local mysql server.
    ie. In file wp-config.php I just set:
    define( 'DB_HOST', '/var/run/mysqld/mysqld.sock' );
    instead of:
    define( 'DB_HOST', 'localhost' );

    whilst WP works as before, NF shows this error in admin page:
    NinjaFirewall fatal error: Cannot connect to WordPress database. Review your installation, your site is not protected.

    I have seen other threads where you recommend to create a file wp-db.php so I did, this is the output:

    Version: 1.9
    Found /var/www/html/mysite.org/wp-config.php.
    Opening it for reading.
    Looking for DB_NAME, DB_USER, DB_PASSWORD, DB_HOST and $table_prefix:
    
        DB_NAME: found 'WP'
        DB_USER: found 'WordPressUser'
        DB_PASSWORD: found (click here to view password)
        DB_HOST: found '/var/run/mysqld/mysqld.sock'
        table_prefix: found 'wp_'
    
    Attempting to connect to the DB:
    Warning: mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/mysite.org/wp-db.php on line 100
    
    Warning: mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/mysite.org/wp-db.php on line 100
    Connection Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
    
    Exiting.

    I have also run the wp-check.php script, this is the output:

    NinjaFirewall (WP edition) troubleshooter
    HTTP server 	: 	nginx/1.18.0
    PHP version 	: 	7.4.3
    PHP SAPI 	: 	FPM-FCGI
     	 	 
    auto_prepend_file 	: 	none
    wp-config.php 	: 	found in /var/www/html/mysite.org/wp-config.php
    NinjaFirewall detection 	: 	NinjaFirewall WP Edition is loaded (WordPress WAF mode)
     	 	 
    Loaded INI file 	: 	/etc/php/7.4/fpm/php.ini
    user_ini.filename 	: 	.user.ini
    user_ini.cache_ttl 	: 	300 seconds
    User PHP INI 	: 	.user.ini found -
     	 	 
    DOCUMENT_ROOT 	: 	/var/www/html/mysite.org
    ABSPATH 	: 	/var/www/html/mysite.org/
    WordPress version 	: 	5.7.2
    WP_CONTENT_DIR 	: 	/var/www/html/mysite.org/wp-content
    Plugins directory 	: 	/var/www/html/mysite.org/wp-content/plugins
    User Role 	: 	Administrator
    User Capabilities 	: 	manage_options: OK - unfiltered_html: OK
    Log dir permissions 	: 	/var/www/html/mysite.org/wp-content/nfwlog dir is writable
    Cache dir permissions 	: 	/var/www/html/mysite.org/wp-content/nfwlog/cache dir is writable
    
    NinjaFirewall (WP edition) troubleshooter v1.9.4

    thanks for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘can’t work with unix socket’ is closed to new replies.