WordPress - Parse/syntax error for localhost

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

WordPress - Parse/syntax error for localhost

Postby lapisfyre » 13. November 2017 20:55

Hello. Thank you for reading this. I am new to XAMPP (for OS X 7.1.10) and BITAMI WordPress install on a MacOS 10.10.5 -- And I am trying to re-do our live website for training teachers.

Here is the problem: connected imported dbase to word press via http://localhost/phpmyadmin/
After researching web found recommendation to change dbase / options table / 'siteurl' and 'home' fields from online url to 'localhost'

PROBLEM occurred when trying to connect to wordpress: http://127.0.0.1/wordpress/

ERROR MESSAGE:

Parse error: syntax error, unexpected 'DB_HOST' (T_STRING), expecting ',' or ')' in /Applications/XAMPP/xamppfiles/apps/wordpress/htdocs/wp-config.php on line 32

On WP-CONFIG.PHP file - Line 31/32 -- this is what it says:

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

Please, what do you recommend to resolve this?

Thank you,
Deborah
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby Nobbie » 14. November 2017 11:31

There is a syntax error in wp-config.php BEFORE that line (either a missing semicolon, or a quote missmatch, or a brackets missmatch or or or). You probably edited that configuration file and made a mistake.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 14. November 2017 18:00

Thanks Nobbie for the suggestion.

I have tried various choices in the line above which is:

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

Options tried were single ' or singe " or nothing ... the parse error varies from line 32 to 29 ... or No database connection.

I guess I will need to look at other options if there is not a way to resolve this.

I really appreciate that you took time to share. Deborah
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby Nobbie » 14. November 2017 20:42

Its a bad idea not to show us the full contents of wp-config.php, i am pretty sure that i would see the error immediately (more or less). The error may also be a couple of lines above. I do not have any OSX machines, but i know (from other requests) that there is a problem with "wrong" quote characters in OSX. There is (somewhere) an invalid quote character on the Mac keyboard which leads to syntax error in many environments (PHP for example).

I am (of course) not sure about your error, it might be a quote problem, it might be any other problem. If you copy&paste your code without any changes into this forum, i will definately find out what is wrong. I cannot help on modified lines, as these mostly hides the error.

lapisfyre wrote:I guess I will need to look at other options if there is not a way to resolve this.


No, thats a waste of time. There is an error in wp-config.php - 100%! If you go somewhere else, you are going wrong.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 14. November 2017 20:55

Thank you Nobbie !

Here's the code:

<?php
/**
* 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', 'tech_wrdp1');

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

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

/** 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', 'e4eab533f60aa8a5e69d00d5b9048a462d71a56e0b91708d9d3596e01ace8e5d');
define('SECURE_AUTH_KEY', '9f6b2fada70b93448443b9c1eabcce50d02bd3652a5c91cf91983ce226276550');
define('LOGGED_IN_KEY', '57ea8f026a10b22ad21fd608581a46103a6c656d12c67ac87d6003497cc7eee5');
define('NONCE_KEY', '161fd42b24c21dbad64b8c201f33787f25f8b0f3c4beb4384652ee634312539f');
define('AUTH_SALT', '77dff36d39acd45f0f36672120337f7417f5a37acc0659e4135c1136457133a7');
define('SECURE_AUTH_SALT', '63af558fe8b1a62f49d0b0d65c18504d84e37eb27be307c1982f9096e70bcaa9');
define('LOGGED_IN_SALT', '76ab5f3a8c86157ecc1f18956f2db4eeb139471d4233319076dad73ac2541147');
define('NONCE_SALT', '710fd7c0480976da5080407d97ec627d30096dfe26cf85518100987eca619766');

/**#@-*/

/**
* 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 blogging. */
/**
* The WP_SITEURL and WP_HOME options are configured to access from any hostname or IP address.
* If you want to access only from an specific domain, you can modify them. For example:
* define('WP_HOME','http://example.com');
* define('WP_SITEURL','http://example.com');
*
*/

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');


/** 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');

define('WP_TEMP_DIR', '/Applications/XAMPP/xamppfiles/apps/wordpress/tmp');


define('FS_METHOD', 'direct');


// Disable pingback.ping xmlrpc method to prevent Wordpress from participating in DDoS attacks
// More info at: https://docs.bitnami.com/?page=apps&name=wordpress&section=how-to-re-enable-the-xml-rpc-pingback-feature

// remove x-pingback HTTP header
add_filter('wp_headers', function($headers) {
unset($headers['X-Pingback']);
return $headers;
});
// disable pingbacks
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
});
add_filter( 'auto_update_translation', '__return_false' );
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 14. November 2017 23:36

And from the Database -

line 1 siteurl http://localhost/wordpress/
line 37 home http://localhost/wordpress/
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby Nobbie » 15. November 2017 15:05

The code is incomplete. Please copy the full code and use the code tags (see above) to show the code:

Code: Select all
<?php
/**
* 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', 'tech_wrdp1');

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

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

/** 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', 'e4eab533f60aa8a5e69d00d5b9048a462d71a56e0b91708d9d3596e01ace8e5d');
define('SECURE_AUTH_KEY', '9f6b2fada70b93448443b9c1eabcce50d02bd3652a5c91cf91983ce226276550');
define('LOGGED_IN_KEY', '57ea8f026a10b22ad21fd608581a46103a6c656d12c67ac87d6003497cc7eee5');
define('NONCE_KEY', '161fd42b24c21dbad64b8c201f33787f25f8b0f3c4beb4384652ee634312539f');
define('AUTH_SALT', '77dff36d39acd45f0f36672120337f7417f5a37acc0659e4135c1136457133a7');
define('SECURE_AUTH_SALT', '63af558fe8b1a62f49d0b0d65c18504d84e37eb27be307c1982f9096e70bcaa9');
define('LOGGED_IN_SALT', '76ab5f3a8c86157ecc1f18956f2db4eeb139471d4233319076dad73ac2541147');
define('NONCE_SALT', '710fd7c0480976da5080407d97ec627d30096dfe26cf85518100987eca619766');

/**#@-*/

/**
* 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 blogging. */
/**
* The WP_SITEURL and WP_HOME options are configured to access from any hostname or IP address.
* If you want to access only from an specific domain, you can modify them. For example:
* define('WP_HOME','http://example.com');
* define('WP_SITEURL','http://example.com');
*
*/

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');


/** 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');

define('WP_TEMP_DIR', '/Applications/XAMPP/xamppfiles/apps/wordpress/tmp');


define('FS_METHOD', 'direct');


// Disable pingback.ping xmlrpc method to prevent Wordpress from participating in DDoS attacks
// More info at: https://docs.bitnami.com/?page=apps&name=wordpress&section=how-to-re-enable-the-xml-rpc-pingback-feature

// remove x-pingback HTTP header
add_filter('wp_headers', function($headers) {
unset($headers['X-Pingback']);
return $headers;
});
// disable pingbacks
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
});
add_filter( 'auto_update_translation', '__return_false' );
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 15. November 2017 20:02

Hi Nobbie,

I hope this is complete. I used the full editor to post the code. FYI -- I am using TextMate to edit the wp-config file and tried to research if something was being hidden the only thing I discovered was about Auto-paired characters and using the delete key to delete the auto character. Otherwise, if this code is not correct I may need some advise on how to copy the code that is missing. Deborah


Code: Select all
<?php
/**
 * 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', 'tech_wrdp1');

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

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

/** 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',         'e4eab533f60aa8a5e69d00d5b9048a462d71a56e0b91708d9d3596e01ace8e5d');
define('SECURE_AUTH_KEY',  '9f6b2fada70b93448443b9c1eabcce50d02bd3652a5c91cf91983ce226276550');
define('LOGGED_IN_KEY',    '57ea8f026a10b22ad21fd608581a46103a6c656d12c67ac87d6003497cc7eee5');
define('NONCE_KEY',        '161fd42b24c21dbad64b8c201f33787f25f8b0f3c4beb4384652ee634312539f');
define('AUTH_SALT',        '77dff36d39acd45f0f36672120337f7417f5a37acc0659e4135c1136457133a7');
define('SECURE_AUTH_SALT', '63af558fe8b1a62f49d0b0d65c18504d84e37eb27be307c1982f9096e70bcaa9');
define('LOGGED_IN_SALT',   '76ab5f3a8c86157ecc1f18956f2db4eeb139471d4233319076dad73ac2541147');
define('NONCE_SALT',       '710fd7c0480976da5080407d97ec627d30096dfe26cf85518100987eca619766');

/**#@-*/

/**
 * 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 blogging. */
/**
 * The WP_SITEURL and WP_HOME options are configured to access from any hostname or IP address.
 * If you want to access only from an specific domain, you can modify them. For example:
 *  define('WP_HOME','http://example.com');
 *  define('WP_SITEURL','http://example.com');
 *
*/

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');


/** 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');

define('WP_TEMP_DIR', '/Applications/XAMPP/xamppfiles/apps/wordpress/tmp');


define('FS_METHOD', 'direct');


//  Disable pingback.ping xmlrpc method to prevent Wordpress from participating in DDoS attacks
//  More info at: https://docs.bitnami.com/?page=apps&name=wordpress&section=how-to-re-enable-the-xml-rpc-pingback-feature

// remove x-pingback HTTP header
add_filter('wp_headers', function($headers) {
    unset($headers['X-Pingback']);
    return $headers;
});
// disable pingbacks
add_filter( 'xmlrpc_methods', function( $methods ) {
        unset( $methods['pingback.ping'] );
        return $methods;
});
add_filter( 'auto_update_translation', '__return_false' );


lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby Nobbie » 15. November 2017 21:58

Its still incomplete. Sorry, but i cannot help you.

A last try (in order to find out if the error is in wp-config.php or possibly above): copy the whole file wp-config.php into your htdocs folder and finally enter http://localhost/wp-config.php into your browserm (or simply click on that link). Which error occurs if you do so?
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 16. November 2017 17:29

Here's what it says:

Warning: require_once(/Applications/XAMPP/xamppfiles/htdocs/wp-settings.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/wp-config.php on line 100

Fatal error: require_once(): Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/wp-settings.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/wp-config.php on line 100

Any clues?

Thanks,
Deborah
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5

Re: WordPress - Parse/syntax error for localhost

Postby Nobbie » 16. November 2017 20:59

lapisfyre wrote:Any clues?


Yes. That means, wp-config.php standalone is error free.And that means, there is some kind of syntax error "above". Of course wp-config.php is included in another startup script, but this is definitaley beyond the scope of this forum. I dont know what is wrong, its a problem in wordpress but i have no idea, where it is. This is not a wordpress forum and we cannot support wordpress. "Something" is wrong with your export/Import, but i havent the slightes clue about that.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: WordPress - Parse/syntax error for localhost

Postby lapisfyre » 17. November 2017 17:28

Thanks, Nobbie. I really appreciate your time in trying to troubleshoot this. I think I will start all over re-install everything and hopefully resolve it. In the meantime I am using a server online and everything is working fine. All the best! Deborah
lapisfyre
 
Posts: 7
Joined: 13. November 2017 20:28
XAMPP version: XAMPP for OS X 7.1.10
Operating System: 10.10.5


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 12 guests