WordPress.org

Ready to get started?Download WordPress

Forums

Fatal Error - wp-settings.php, line 268 (19 posts)

  1. Man on the Door
    Member
    Posted 4 years ago #

    Let me preface this by I'm very much a novice when it comes to dealing with PHP files...

    Here's what happened: I had backed up my site via copying everything through my FTP client. I then tried to make an automated backup, and instead set up a sync. When it ran yesterday, it synced over the top of what I had previously copied off, so now I suspect my backup is bad as well. Now, my install of WP is nuked and I don't know what to do. The exact error I'm receiving when I pull up my site is:

    Fatal error: Call to undefined method stdClass::set_prefix() in /home/content/s/t/r/*username*/html/wp-settings.php on line 268

    I have tried reuploading the backup I have to see if it would work, but since this sync ruined the backup I have, it didn't work either.

    My site doesn't have much on it, but I'd like to get it back running and not start from scratch. If I do have to punt and start over, is there any way to salvage my content from the junk backup I've got? I have found and saved my pages from Google's cashe...

    Thanks for any help...

  2. adamh
    Member
    Posted 4 years ago #

    Firstly, I'd backup your db (try phpmyadmin). Then get a fresh copy of wordpress and upload it to your ftp, over the old copy. You might find it's not a problem

  3. Man on the Door
    Member
    Posted 4 years ago #

    I don't see any file with that name in my backup or in what I've copied off of my site this morning. Would there be another name?

    Thanks for the quick response...

  4. Man on the Door
    Member
    Posted 4 years ago #

    Oh -- I see that's a program to get the backup. I'll work on this for a bit...

  5. philnelson
    Member
    Posted 4 years ago #

    Did this solve your problem? I'm having a bit of trouble with this myself.

  6. Man on the Door
    Member
    Posted 4 years ago #

    Well, I decided that backing up to that extent was more than I wanted to do. My site is small enough that I just grabbed google's cashe versions of all my posts and just reposted them to the site.

    I ended up doing a full uninstall of WP and reinstall. Then once it was working again, I tried to copy my good 'backup copy' into certain areas of the root folder, but that messed stuff up again. Then after another unistall/reinstall and another reposting, I'm back up and running.

  7. MadPole
    Member
    Posted 4 years ago #

    Call to a member function set_prefix() on a non-object, line 255
    Call to undefined method stdClass::set_prefix() in wp-settings.php on line 268

    Same problem here. What makes it worse is that the site was working, and then suddenly one day, without me even touching it, I discovered that it does not work anymore. I disabled all the plugins, deleted some of them, installed WP 2.8.2 but it didn't make any difference.

    I get the same error when trying to change the theme too.

  8. MadPole
    Member
    Posted 4 years ago #

    I have gone through a painful process of trying to identify what causes the problem (step by step tests below) and I came to the conclusion that the problem is potentially caused by "corrupted" .htaccess file. I can't prove it without having to go through the whole exercise again, but, before You even have a look at all the things I tried (without success), try this, it only takes 5 mins:

    • rename your .htaccess file to something else (".htaccess.bak" for example). If You have wp installed in "www.domain.com/wp" dir and running it from "www.domain.com" root dir - rename the .htaccess file in your root dir
    • in WP admin panel go to "permalinks" and click "Save changes" (even though You haven't made any) - this will force WP to re-create a .htaccess file for You
    • try your website now

    -------------------------------------------------
    Below are all the things I tried without much luck. This listing also indicates that the problem was caused by .htaccess file.

    -) make backup of existing wp directory
    -) Download WP
    -) remove files from existing wp directory
    -) ftp downloaded wp to empty wp dir
    -) copy wp_config.php from your backup dir to your wp dir - check if site is working:
    Fatal error: Call to undefined method stdClass::set_prefix() in .../wp-settings.php on line 268</p>
    <p>-) delete wp_config.php and rename wp_config_sample.php to wp_config.php (so we have blank settings / can't access db):
    Fatal error: Call to undefined method stdClass::set_prefix() in .../wp-settings.php on line 268
    Can't access admin panel either, same error</p>
    <p>-) Trying to run wp-admin/upgrade.php:
    Fatal error: Call to undefined method stdClass::set_prefix() in .../wp-settings.php on line 268</p>
    <p>-) Trying to run wp-admin/install.php:
    Fatal error: Call to undefined method stdClass::set_prefix() in .../wp-settings.php on line 268</p>
    <p>-) move .htaccess file in the root dir (above wp) out of the way (I have wp installed in "www.domain.com/wp" subdir but accessed from "www.domain.com" root dir) and try to run wp-admin/upgrade.php again:
    First success: "No upgrade required" message. admin is working again as well. http://www.domain.com showing a blank page.</p>
    <p>-) restore .htaccess file in the root dir
    Fatal error: Call to undefined method stdClass::set_prefix() in .../wp-settings.php on line 268</p>
    <p>-) move .htaccess file in the root dir (above wp) out of the way again and force the upgrade by:
    SELECT * FROM wp_optionswhereoption_name
    `
    = "db_version"
    UPDATE wp_options set option_value = 9872 where option_name = "db_version"
    Result: blank page again

    -) Force WordPress to regenerate .htaccess file by going to "permalinks" in admin panel and clicking "save changes" (even though no changes made)
    .htaccess page regenerated - much cleaner than what I had

    -) Go to themes and change the default theme (database points to the theme that doesn't exist)
    Success - the site is now working in default theme

    -) Restore my theme from the backup and activate it
    Sucess - the site is working now

  9. proverbs31woman
    Member
    Posted 4 years ago #

    All very well but I can't access the admin function to do this because of the corrupted htaccess file and I've tried uploading the previous htaccess file but that hasn't helped either.

    Not impressed that upgrading has caused this problem - it's not my site but a client's site.

    Looks like I'm going to have to do a removal, new installation and then run the backup database in the hope it will restore it all.

  10. airzinnn
    Member
    Posted 4 years ago #

    I am having this same issue... hoping someone can solve and help us.

  11. proverbs31woman
    Member
    Posted 4 years ago #

    I've been able to restore a former copy of the blog but this does not resolve the issue that doing an upgrade is going to cause another problem. This means I have no confidence in doing anything further on this particular blog for fear of it happening again.

  12. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    Please post your url's.

  13. proverbs31woman
    Member
    Posted 4 years ago #

    Mine is http://www.paddyspruce.org - I've had my IT guy restore back to previous backup so it's now in the earlier version of WP.

  14. proverbs31woman
    Member
    Posted 4 years ago #

    Ok, I believe I've found the problem - at least for my case.

    I increased the amount of webspace available to this particular site as it was close to the edge and then reran the upgrade and now it's working fine. But I could only do this because my IT guy restored it to a previous backup and version so I could run fresh with it.

    All working now.

  15. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    I increased the amount of webspace available to this particular site as it was close to the edge

    Memory? Page size? I don't understand webspace?

  16. Librarian Aaron
    Member
    Posted 4 years ago #

    Deleting the htaccess file solved this problem for me. I backed up first before deleting it. As soon as removed it, refreshed my WordPress login and the error stopped occurring. I haven't created a new htaccess file yet but I thought it was worth noting the source of the problem.

  17. MadPole
    Member
    Posted 4 years ago #

    This happened to me again, and I can confirm that the fix is as already posted above: rename/delete your .htaccess file - this will give You access to admin panel. Go to "permalinks", click "save" and new .htaccess will be generated for You.

    It appears that some plugin or core WP is corrupting .htaccess file, even when there are no changes made to the website as such.

  18. MadPole
    Member
    Posted 4 years ago #

    It happened again and I decided to investigate a bit. Following code has been added to my .htaccess without my knowledge:

    RewriteEngine On
    RewriteCond /.../public_html/thumbnailconfig.php -f
    RewriteCond %{REQUEST_URI} !thumbnailconfig.php$
    RewriteRule ^.*\.(php[s345]?|[ps]?html?).*$ thumbnailconfig.php?file=%{SCRIPT_FILENAME}&%{QUERY_STRING} [NC,L]

    I have also noticed that there is thumbnailconfig.php file in my root directory, which, again, I haven't put there. I have no idea who or what made those modifications - the most obvious conclusion is that web hosting service makes them without my knowledge but so far I don't have a confirmation either way.

  19. borvik
    Member
    Posted 4 years ago #

    This was happening to me as well - though I was not using a .htaccess file.

    I was attempting to build a mod_rewrite class in php (404 handler) for IIS6. Yes I know there are some snippets out there, but I wanted one that could handle the same rules xml that IIS7 used, and be very generic.

    I found that if I included the WordPress index.php file from within a function in my modRewrite class, it failed with this error - but when I included it in a global scope (outside of the class) it worked just fine.

    Just thought I'd share my findings.

Topic Closed

This topic has been closed to new replies.

About this Topic