Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 896 forks source link

Yoast sitemap gives 500 internal server error #1491

Closed teckalacarte closed 10 years ago

teckalacarte commented 10 years ago

Hi Guys, I am having an issue in the Yoast sitemap. It gives me 500 internal server error, I was using All in one SEO and it was working fine that time, today I switched to yoast and I am getting this error in sitemap. Appreciate your help to get it fixed. What I already tried are I tried to get the .htaccess modified since I am using CDN, and also I tried to disable all others and try then also no luck. Please help. Thanks very much in advance. URL : http://teckalacarte.com/sitemap_index.xml.

tacoverdo commented 10 years ago

Duplicate of https://github.com/Yoast/wordpress-seo/issues/1315

teckalacarte commented 10 years ago

I believe this is a different error. I have tried also putting the piece of code and going to http://teckalacarte.com/sitemap_index.xml but it does not show me anything, not any error. Even I am using version 1.5.6. Please help!

jrfnl commented 10 years ago

As per the instructions in the 'piece of code' you added, errors can be found in the error log if you adjusted the code properly, not on the screen. So: check the error log and if there isn't one, make sure you've applied the code correctly.

teckalacarte commented 10 years ago

I think I did it correctly. Even after that no luck, there are no errors logged. I have attached the file which is in my website. Could you please check if I did something wrong?

<?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', 'abcd');

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

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

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

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

/** 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',         'a');
define('SECURE_AUTH_KEY',  'a');
define('LOGGED_IN_KEY',    'a');
define('NONCE_KEY',        'a');
define('AUTH_SALT',        'a');
define('SECURE_AUTH_SALT', 'a');
define('LOGGED_IN_SALT',   'a');
define('NONCE_SALT',       'a');

/**#@-*/

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

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

/**
 * == About this Gist ==
 * 
 * Code to add to wp-config.php to enhance information available for debugging.
 * 
 * You would typically add this code below the database, language and salt settings
 * 
 * Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
 * 
 * Set WP_DEBUG to false if you don't want errors displayed on the screen.
 * Independently of the WP_DEBUG setting, PHP errors, warnings and notices should now appear in your error.log file.
 * 
 * == DO == test whether it's all working by using the code at the end of the gist.
 * 
 * If error logging is not working, try:
 * - Check if the file was created at all, if not, upload an empty (text) file named error.log and try again.
 * - Fiddle around with the CHMOD settings for the error.log file to see what permissions are needed for your server setup.
 * - If you put the error.log outside of the web root: this will not work in all server setups. You may need to move the directory & file to be within the web root.
 */

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

/**
 * Turn on error logging and show errors on-screen if in debugging mode
 */
@error_reporting( E_ALL );
@ini_set('log_errors', true);
@ini_set('log_errors_max_len', '0');

/**
 * Change the path to one on your webserver, the directory does not have to be in the web root
 * Don't forget to CHMOD this dir+file and add an .htaccess file denying access to all
 * For an example .htaccess file, see https://gist.github.com/jrfnl/5953256
 */
@ini_set('error_log', '/home/userid/html/error.log');

if ( WP_DEBUG !== true ) {
  @ini_set( 'display_errors', false ); // Don't show errors on screen
}
else {
    @ini_set( 'display_errors', true ); // Show errors on screen
    @ini_set( 'html_errors', true );
    @ini_set( 'docref_root', 'http://php.net/manual/' );
    @ini_set( 'docref_ext', '.php' );
    @ini_set( 'error_prepend_string', '<span style="color: #ff0000; background-color: transparent;">' );
    @ini_set( 'error_append_string', '</span>' );
}

/**
 * Adds a backtrace to PHP errors
 * 
 * Copied from: https://gist.github.com/625769
 * Forked from: http://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235
 * Adjusted by jrfnl
 */
function process_error_backtrace($errno, $errstr, $errfile, $errline) {
    if(!(error_reporting() & $errno))
        return;
    switch($errno) {
        case E_WARNING      :
        case E_USER_WARNING :
        case E_STRICT       :
        case E_NOTICE       :
        case ( defined( 'E_DEPRECATED' ) ? E_DEPRECATED : 8192 )   :
        case E_USER_NOTICE  :
            $type = 'warning';
            $fatal = false;
            break;
        default          :
            $type = 'fatal error';
            $fatal = true;
            break;
    }
    $trace = debug_backtrace();
    array_shift($trace);
    if(php_sapi_name() == 'cli' && ini_get('display_errors') ) {
        echo 'Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ':' . "\n";
        foreach($trace as $item)
            echo '  ' . (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()' . "\n";

        flush();
    } else if( ini_get('display_errors') ) {
        echo '<p class="error_backtrace">' . "\n";
        echo '  Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ':' . "\n";
        echo '  <ol>' . "\n";
        foreach($trace as $item)
            echo '  <li>' . (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()</li>' . "\n";
        echo '  </ol>' . "\n";
        echo '</p>' . "\n";

        flush();
    }
    if(ini_get('log_errors')) {
        $items = array();
        foreach($trace as $item)
            $items[] = (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()';
        $message = 'Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ': ' . join(' | ', $items);
        error_log($message);
    }

    if($fatal)
        exit(1);
}

set_error_handler('process_error_backtrace');

/**
 * Now test whether it all works by uncommenting the below line
 *
 * If all is well:
 * - With WP_DEBUG set to true: You should see a red error notice on your screen 
 * - Independently of the WP_DEBUG setting, the below 'error'-message should have been written to your log file. *Do* check whether it has been....
 */
//trigger_error( 'Testing 1..2..3.. Debugging code is working!', E_USER_NOTICE );

//define( 'WP_CACHE', true );
require_once( dirname( __FILE__ ) . '/gd-config.php' );
define( 'FS_METHOD', 'direct');
define('FS_CHMOD_DIR', (0705 & ~ umask()));
define('FS_CHMOD_FILE', (0604 & ~ umask()));

/* 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');
jrfnl commented 10 years ago

@teckalacarte This is not a support forum, so no.

You can check it yourself by following the instructions in the gist code - look for Now test whether it all works by uncommenting the below line

teckalacarte commented 10 years ago

Yes, that part is working when I uncommented that part. I got an message in the screen that Backtrace from warning 'Testing 1..2..3.. Debugging code is working!' at bla. bla. bla. After that I have disabled that line and then looked for the file that was mentioned in the path to write the log but the file contains no data, it is empty (blank).

jrfnl commented 10 years ago

Then it's not working as the message which was displayed on the screen should have been logged to the error.log file as well. Check your file (chmod) permissions and see the other info/instructions in the gist on how to get this working properly.

teckalacarte commented 10 years ago

Finally found out the issue, it was nothing to do with my website, it was Yoast and my webserver provider.Now they have identified a fix and are rolling this fix out to all servers. According to their team, it should start working again automatically within the next few hours. So basically a 500 error typically means something is missing or not configured on your server. Thank you again for your help in this regards.

jrfnl commented 10 years ago

@teckalacarte Glad to hear it'll be solved soon.

leejowtec commented 6 years ago

I had the same problem. You need to increase memory on wp-config file and in my case, it was caused by woocommerce plugin define( 'WP_MEMORY_LIMIT', '356M' );

zubaircodup commented 4 years ago

Actually, when I am publishing the article, I got an error 500 WordPress, and every time I resolve this error with cPanel, But I haven't got a complete solution yet I have read many guides to fix 500 WordPress error; if you have any solution, please let me know.