• The error message from the log is: PHP message: PHP Parse error: syntax error, unexpected T_STRING in /var/www/wp-config.php on line 88

    Yesterday, I did a new install of WordPress, using the latest release, on Ubuntu. I did this after configuring Apache2 to use PHP-NPH. I also installed dnsmasq, so that I could have all subdomains for my test domain mapped to 127.0.0.1. I wanted to test that the multisite configuration would work proprly in this environment.

    It seemed to do so, so went to the tools submenu, to configure the network. I followed the instructions there, and once finished, attempted to log in, as directed. But the page was blank (and view source showed that it wasn’t just a matter of invisible content, but that there was no content.

    I looked at the Apache error log, and found the above error. Here are the lines I was told I needed to add to wp-config.php:

    /* Multisite */
    define( 'WP_ALLOW_MULTISITE', true );
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE','byerspublishing.com')
    define('PATH_CURRENT_SITE', '/')
    define('SITE_ID_CURRENT_SITE', 1)
    define('BLOG_ID_CURRENT_SITE', 1)

    Obviously, the multisite comment and WP_ALLOW_MULTISITE lines were added before attempting to install. Line 88 is that which defines PATH_CURRENT_SITE. Comparing it with any of the other defines in the multisite section, I do not see anything awry. But, the error complains about an unexpected T_STRING. What is that? I have only a passing acquaintance with PHP (just enough to be dangerous), as I program in C++ and Perl, with a little Java and Javascript thrown in for good measure, so I need someone to explain to me what a T_STRING is, and how to find one that is unexpected.

    How do I fix this?

    Thanks

    Ted

Viewing 10 replies - 1 through 10 (of 10 total)
  • You’re missing some semicolons at the end of lines 87-90 — add them and the error will probably be gone.

    /* Multisite */
    define( 'WP_ALLOW_MULTISITE', true );
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE','byerspublishing.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    Thread Starter ted.byers

    (@tedbyers)

    Thanks Senff. That was it.

    Alas, fixing that reveals another problem. I now get a new error, now: “Error establishing a database connection“. What makes this more odd is that there is no coresponding error in either the apache2 logs nor the MySQL logs. Further adding to the weirdness is that I can connect to the wordpress DB user/schema using the credentials I have in my wp-config.php file. So, what could possibly cause problem establishing a database connection when the database is up and running, and the credentials wordpress is configured to use work fine, in the mysql client? The wordpress installation script had no problem establushing a connection, to create all those tables that it did.

    How do I force it to give me more detail as to why it couldn’t connect, and how do I fix it?

    Thanks

    Ted

    The error you’re getting now occurs when the database info (database name, user and password) are incorrect. Make sure that all the info matches the database you set up exactly. Typos are made easily! 🙂

    Thread Starter ted.byers

    (@tedbyers)

    Yes, I know that, but that can not be the case here, because the data for the database are correct, and in fat have not been changed since before I installed WordPress in the first place. And, during the initial installation, it had no problem connecting to the database. So, what else can cause this kind of failure?

    Thanks

    Ted

    We’d have to see the contents of your entire wp-config.php file (with the username/password removed of course) to see what could be wrong…until then, we can only guess I’m afraid.

    Is it possible the database details were changed?

    Thread Starter ted.byers

    (@tedbyers)

    OK, here is wp-config.php:

    <?php
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information
     * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @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', <em>[redacted</em>]);
    
    /** MySQL database password */
    define('DB_PASSWORD', '<em>[redacted</em>]);
    
    /** 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',         'Ld99#/|^!*l@4ibWX16-vA.nYxe-/3vvJSUyDGf(2OO!3w+nx/_1Xn ruUA_A.M');
    define('SECURE_AUTH_KEY',  '|>]9wNZVC =6v0uxC^*})d+[msd1=ixuy~x6w};3 9T:+3}Cf49)O:0~WIZ)63sK');
    define('LOGGED_IN_KEY',    '[B<s*Ut)cPA-+SY)iYyRU^=a9S>K*qe9-Zk5]TO&-uHL6AV 8{|%ur>lap^9zGd');
    define('NONCE_KEY',        '-:!#%XedZ,(#/{AK:Oc{x<+7ddN ~;=/j,|-w[]UqB<fZ:.4N}&23 xA@euhCi1~');
    define('AUTH_SALT',        'Ev].<QXr#QLo;-WG1o%n?mg(JDc|$)kRB]#ir|h|.T};K|:s{tCo.+Ke%lXl3/H');
    define('SECURE_AUTH_SALT', 'h +(!--A6]|.pxGQ#MP
    
    Eqf!Y.mO@U+/A#Vj<k]K((>I/r/QWHma3o-G|-$l>8+9');
    define('LOGGED_IN_SALT',   '<x<J>8S:Mrua-|AeSh&HeRk!R%9>Yio]oUq+R)(WT9/K#er@(+!fQ{@x@UT=7WUs');
    define('NONCE_SALT',       '0i|SF<gpr{ AZ/B2H^BR1i_k~]5K=vAOS{~2cTHq:hgnjHQDoS q{iL~8lTfyk(');
    
    /**#@-*/
    
    /**
     * 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_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress. A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
     * language support.
     */
    define('WPLANG', '');
    
    /**
     * 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.
     */
    define('WP_DEBUG', false);
    
    /* Multisite */
    define( 'WP_ALLOW_MULTISITE', true );
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'byerspublishing.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    
    /* That's all, stop editing! Happy blogging. */
    
    /** 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');

    And heree is my latest session, showing that the credentials entered into wp-config.php are correct and working:

    ted@Ubuntu-Server:~$ mysql -u wordpress -pDidr39Qcab wordpress
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 59
    Server version: 5.5.35-0ubuntu0.12.04.2 (Ubuntu)
    
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> exit
    Bye
    ted@Ubuntu-Server:~$

    So, no, the database details have not been changed.

    What else can/should be checked?

    Thanks

    Ted

    PS: I suppose I will need to change the user name and password, having posted this. Right?

    I’m not very familiar with Unix and command line stuff but I assume you triple-checked that this is the correct syntax:

    ted@Ubuntu-Server:~$ mysql -u wordpress -pDidr39Qcab wordpress

    Though shouldn’t there be a space between -p and Didr39Qcab ?

    You could also try this:

    $mysql -u wordpress -h localhost -p

    And then:

    SET PASSWORD FOR 'wordpress'@'localhost' = PASSWORD('Didr39Qcab');

    But again, I’m not very familiar with Unix/Linux so maybe someone else can shed some light on it. My guess is still that the password is not correctly set in the database.

    Thread Starter ted.byers

    (@tedbyers)

    Actually, the mysql client does not want a space between ‘-p’ and the password.Of course, I checked that. I use that syntax, with and without, the host specification, depending on which database I am accessing, every day.

    There is no doubt that the credentials for the wordpress user are set correctly, as my connection to the database using the mysql client shows.

    It may be a coincidence, but WordPress’ capability to connect broke once I did the configuration to add support for a multisite installation. The line ‘define( ‘WP_ALLOW_MULTISITE’, true );’ did not break connection to the database, but I wonder if the other multisite define statements might have broken it, with the wordpress user connecting only from localhost. Does mysql see the wordpress user connecting from localhost, as it ought, or from some domain from the WWW (as it probably shouldn’t)?

    Thanks

    Ted

    Ah yes — you were logging in to the database, I see now (I thought you were setting the username and password).

    So as soon as you remove the Multisite lines, there is no problem with connection to the database?

    Thread Starter ted.byers

    (@tedbyers)

    Yep!

    /*
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'byerspublishing.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    */

    Commenting out the above lines there is no problem with connecting to the database! Now, the question becomes, “WHY, and how is this to be fixed?” What do these defines actually do and how, are they needed for proper subdomain multisite funtionality, and how do we have both database access and these defines?

    Thanks,

    Ted

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘PHP message: PHP Parse error: syntax error, unexpected T_STRING in …’ is closed to new replies.