nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.37k stars 323 forks source link

Wordpress error #364

Open pilot87 opened 4 years ago

pilot87 commented 4 years ago

May be it is not UNIT error: i've set up Wordpress with this instruction https://unit.nginx.org/howto/wordpress/ but site have response with 500 error code

2019/12/27 09:44:25 [notice] 6583#6583 php message: PHP Warning:  Unknown: Filename cannot be empty in Unknown on line 0
2019/12/27 09:44:25 [notice] 6583#6583 php message: PHP Fatal error:  Unknown: Failed opening required '' (include_path='.:/usr/share/php') in Unknown on line 0

My wp-config.php is

/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'web' );

/** MySQL database password */
define( 'DB_PASSWORD', 'SIFbic1!' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'x+0r&m=0|u%J}b7ZI}ww9$OR[jC4t9E+U%[BwSt7!@g8}>1Z0/xxvL>s0,Q9q|+x');
define('SECURE_AUTH_KEY',  ';*OP2yzIeN(S`T!!;}8-j(#wq@-tmt$->q#2QdPzG lz*&R>47)B*uy%%T>fgu0N');
define('LOGGED_IN_KEY',    '`XYK@`Ax^k.qJwR=|*Y8!O@:[7H+UhcZE;bmT~WRZd`XGk$H.d0j*-5{6ZYRok8|');
define('NONCE_KEY',        'tP[ UHm4<Bx9x34-joL|-.J6d|.Ac8jZ7tn6?,qKt(dUN3jov.T;r+87Ghs^->B:');
define('AUTH_SALT',        '9#@8pGbyEZ!RiI|-CidB+fc+=)&V%)A4~N6&=e-vppH7X Gqr=a2JZJBB++k/b6;');
define('SECURE_AUTH_SALT', '.b8lz)rtJnjk++?7`7}+Jp}q_zx3 @#^`BHl-%6_P5VOCRYWdMjc[9)o-,2tN9J$');
define('LOGGED_IN_SALT',   '$&gy.!a;acNW#>X4%Dk -!XSOH@||=_N$@*Ktn&Vxlmk:wf8IBf{*I%)8.J#/UV=');
define('NONCE_SALT',       'NWD N^bnTPbb=SQkOM);5|b09e7I[1=m+O5KU48J:b&>We?.:O^|_.H7.&0=f~+x');

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );

My config is

{
    "listeners": {
        "*:8080": {
            "pass": "routes/wordpress"
        },
        "*:80": {
            "pass": "routes/wordpress"
        },
        "*:443": {
            "pass": "routes/wordpress"
        }
    },

    "routes": {
        "wordpress": [
            {
                "match": {
                    "uri": [
                        "*.php",
                        "*.php/*",
                        "/wp-admin/"
                    ]
                },

                "action": {
                    "pass": "applications/wp_direct"
                }
            },
            {
                "match": {
                    "uri": [
                         "/wp-admin/*",
                         "/wp-content/*",
                         "/wp-includes/*"
                    ]
                },

                "action": {
                    "share": "/site/wordpress/"
                }
            },
            {
                "action": {
                    "pass": "applications/wp_index"
                }
            }
        ]
    },

    "applications": {
        "wp_direct": {
            "type": "php",
            "user": "web",
            "group": "web",
            "root": "/site/wordpress/"
        },

        "wp_index": {
            "type": "php",
            "user": "web",
            "group": "web",
            "root": "/site/wordpress/",
            "script": "index.php"
        }
    },
    "access_log": "/var/log/access.log"
}

Please tell me - what I am doing wrong.

mar0x commented 4 years ago

Error messages is similar to messages in #360 . Please ensure Unit PHP module uses same libphp version as it is compiled (for instance with ldd php.unit.so).

pilot87 commented 4 years ago

I am not fully understand conception of php versions nor awareness how to check one but changing php version to 7.2 solved this problem. Previously I ve instlall php7.4 on my Ubuntu 18.04 throw is instracion https://www.cloudbooklet.com/how-to-install-php-7-3-on-ubuntu-18-04/

VBart commented 4 years ago

@pilot87 Unit packages in our own repositories are built with the official php packages bundled with the distribution. If you're using your own php build or some other 3-rd party packages, then you have to compile also a Unit module for this custom made php. Please note, that many 3rd-party php packages don't expect to be installed along with the official php package from the distribution. They put php library in the same directory with the same soname, as a result it's not possible for system loader to distinguish between these libraries. Since there's no ABI compatibility between php versions, loading a wrong library (not the one used to compile Unit module) can cause various problems, including the one you've observed.

piotrpazola commented 3 years ago

@pilot87, I've just made Docker Image of NGINX Unit with PHP 7.4 and PDO MYSQL using Custom Module approach. More information in similar issue #402