WordPress.org

Ready to get started?Download WordPress

Forums

404 after save or publish a post (80 posts)

  1. Mazalien
    Member
    Posted 8 years ago #

    Hello everybody

    After uprading to 2.01 I get everytime a 404 when I wrote a post an press " save" or "publish" or "save and continue editing". Does anybody experience the same and how to solve this ?

  2. sparkiem
    Member
    Posted 8 years ago #

    I am having the same problem, It does this about 75% of the time. The other 25% of the time it works fine. I can't figure it out because if I try something and then it works for a while and I think it is fixed, then right back to not working again. I thought reuploading the wp-admin folder had done it, but I just tried it and it gave me the 404.

    If you come up with anything please let me know.
    http://www.grandfatherclocksplus.net/blog

  3. MattRead
    Member
    Posted 8 years ago #

    3 things:

    1. Ensure that you have run /wp-admin/upgrade.php.

    2. Check that the "WordPress address (URI)" and "Blog address (URI)" is correct in Options > General (no trailing slash).

    3. Try removing http://rpc.pingomatic.com/ from the "Update Services" list in Options > Writing.

  4. Mazalien
    Member
    Posted 8 years ago #

    MattRead
    Thanks for your suggestions. I have tried all of that before posting this topic. The problem still remains....

  5. mersenne
    Member
    Posted 8 years ago #

    ok here's the deal, i was going to post about this a few mins. ago and i saw this thread at the top!. i've been going mad for the last 2 hours trying to understand with my limited knowledge of php.. :)

    this is what i understood after some tries.. it seems wordpress limits the post to 1000 characters.. before that it saves and previews normally, but when i add the rest of the post, it gives a 404 error saying sorry the page you requested is not found.. after this i went back and manually added more characters until the point , where it doesn't save the point, did a word count and it came surprisingly as 999 (with spaces).. I then settled to find more on this, but couldn't.. maybe there are some people who knows if this is a bug, or a feature that can be deactivated somewhere. this happens on previous posts as well, i had this error when i was manually updating some old posts too.. please help soon, since i can't post anything like this..

  6. mersenne
    Member
    Posted 8 years ago #

    ermm, and the interesting thing is there have been many posts that have more than 1000 characters on my blog .. so it makes the problem more complex..

  7. mersenne
    Member
    Posted 8 years ago #

    well, can any developer or any experienced user elaborate?
    i'm getting the same msg on another blog now, i've told a php savvy person and he's going mad as well.. now the 1000 character thing is not true, i've gone over it debunking myself.. :)

    the other blog gives the same error when saving theme files now.. when i type this is a test, it saves, when i type what i really should type it gives a 404 ..

    or this post i was talking about above. It's there as a draft, I can preview it, I can add other random stuff like asdasda to it, I can add the same sentence over and over and it saves normally, whenever I try to write a rational sentence it gives a 404, this is by far the most creepy error i get from any software, as if the soul of the machine is watching what i type..

    btw the thing im trying to type has no strange characters, or code in it.. and what's more i can type it after those stupid stuff i write and it saves it again, i remove them and it gives a 404, i'm really baffled.. it seems random and i feel like a caveman trying to understand life.. ticking every random thing i find and trying to solve this puzzle.. and our gods have left us.. :(

  8. Levander
    Member
    Posted 8 years ago #

    I'm wondering if this issue is a problem with using a different version of mysql, php, or apache.

    I don't get this issue on my local machine, but do on my production server. My production server is RHEL, my local machine is Ubuntu.

    The production server is running:
    MySQL: 4.0.25-standard
    PHP: 4.4.0
    Apache: 1.3.33

    The local machine is running:
    MySQL: 4.1.12-1ubuntu3
    PHP: 4.4.03
    Apache: 2.0.54-5ubuntu2

    The local machine is running Ubuntu breezy. I don't know how to figure out what version of RHEL the product server is running.

  9. Levander
    Member
    Posted 8 years ago #

    Actually, my problem isn't that I got a 404. My problem is that hitting "Publish" or "Save" would take forever then send me to a blank page. It's similar, but not exactly what the originall poster described.

    However, my hosting company actually updated their servers last night, and the problem has vanished! Making me believe it was an issue with different versions of software on the server.

    New versions on the server:
    Apache: 1.3.34 (Unix)
    MySQL: 4.1.18-standard
    PHP: 4.4.1

    My guess is it was moving the MySQL server from 4.0 to 4.1. Maybe WordPress 2.0 doesn't play with MySQL 4.0 very well?

    They moved the files and everything themselves, I didn't play with anything.

  10. Ruby Sinreich
    Member
    Posted 8 years ago #

    I am having this same problem since I upgraded to 2.0.1, no matter what the length of the post is. The actual URL it tries to go to after I publish is http://lotusmedia.org/wp-admin/%3Cdiv%20id=%5C'error%5C'%3E

    I am using Dreamhost, should I switch it using PHP 5?

    = Ruby

  11. Ruby Sinreich
    Member
    Posted 8 years ago #

    In answer to my own question, I just tried changing my web hosting account to run PHP version 5, and the problem seems to have gone away. I'll post again if it returns...

  12. Ruby Sinreich
    Member
    Posted 8 years ago #

    I spoke too soon. I just saved a post without publishing and I got the same error! I am now reconsidering whether this was length-related...

    Any clues are welcome.

  13. jeffparsons
    Member
    Posted 8 years ago #

    Has anyone gotten any further with this? At the moment, I have several larger posts that I can't get into my blog. It may not be exactly 1000 chars, but it does seem size related. And it isn't consistent. Any Progress?

  14. rdsmes
    Member
    Posted 8 years ago #

    For what it's worth, I had a particular post that was being stubborn and giving me the 404 error each time I saved it, and was able to glean a little info from seeding the 'post.php' file with a few 'error_log' statements and seeing what popped up in the php error log.

    The problem seems to result from the '$location' for redirection in post.php being set incorrectly (duh). In this case, the path being taken through the post.php file went through the 'editpost' action/case, and $location was set by the
    elseif (isset($_POST['referredby']) && $_POST['referredby'] != $_SERVER['HTTP_REFERER'])
    {
    $location = $_POST['referredby'];

    lines in that case (line 113-114). The location was NOT then altered by the following if statement and get_permalink () call.

    You can't tell this from the resulting address in the browser after the failure, but the entire $location seems to be set to:
    <div id='error'> <p class='wpdberror'><strong>WordPress database error:</strong> [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY post_id, meta_key' at line 1] <code>SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN() ORDER BY post_id, meta_key</code>
    </div>http://www.whateveryourblogis.com/wp-admin/post.php

    That's the only info I've gotten so far - it would seem that the problem, at least in this case, was tied to that line of $location = $_POST['referredby'] on line 114 of post.php.

    At least that's what my simple debug would indicate. I'm not sure where that error info comes from, or if 'referredby' just happens to be garbage at that point. Maybe that info from the incorrect $location will ring a bell with somebody.

  15. rdsmes
    Member
    Posted 8 years ago #

    The problem also appears to be related to the 'save and continue editing' feature. Start a new post - halfway through, hit 'save and continue editing'. That returns you to the post. Finish the post - hit 'save'. Bang - 404.

    Maybe that's why some of you are seeing it with 'longer' posts - do you use 'save and continue editing'?? I use it a lot, just out of a paranoid habit.

    More digging required...

  16. rdsmes
    Member
    Posted 8 years ago #

    More follow-up - all info here applies to my case, YMMV. The page sent back to the browser after I do a 'save-and-continue-editing' operation already has the 'referredby' field for the submit button screwed up with the database warning string.

    If you are one of the folks seeing this 404 issue - try it: start the browser fresh, and go to the 'write' page. Start typing a new post, then hit 'save and continue editing'. When the edit page refreshes, do a 'view source' in your browser. Look for the "input name=referredby", and take a look at what's in the 'value' field. That's the error string that is then getting sent in the 'referredby' field on the next save or publish operation, and causing the 404 error.

    Now we just need to find out why that string is there...

  17. rdsmes
    Member
    Posted 8 years ago #

    The problem is caused by a query done by the url_to_postid function call in the 'if' statement on line 212 of wp-admin\edit-form-advanced.php when the 'save and continue editing' operation is performed.

    Since I'm not a mySQL expert by any stretch, I'm not sure what's wrong with the query.

  18. JPigford
    Member
    Posted 8 years ago #

    I'm with others here and having this site crippling issue. If I can't post, then I'll be abandoning WordPress.

  19. rdsmes
    Member
    Posted 8 years ago #

    It's not site crippling by any means - the post mechanism still works fine, it just returns your browser to a non-existent page.

  20. jeffparsons
    Member
    Posted 8 years ago #

    In your case, perhaps the post is saved. I've been trying to follow your sleuthing and it seems like good work, though I know squat so let the buyer beware.

    I do know, that the post on one of my setups is not saved. I don't use "save and continue". I have a local setup, and two on hosting services and only one of them refuses to save or publish, depending on which button I click. Type a few extra characters in the post and ... no go. Not consistently on the one host that is giving trouble as I was able to get it to take one larger post.

    There are slightly different versions of Apache, PHP, and MySQL involved, I can dig them up if someone thinks it will help, though only minor version numbers.

    rdsmes, perhaps your on the right track, do keep it up, just thought I would chime back in.

  21. rdsmes
    Member
    Posted 8 years ago #

    I'm certainly in no position to say that there aren't multiple problems. I can only speak to the one I'm seeing that I've detailed above. And in my case, the posts are actually getting posted, but the browser is redirected to never-never land. That is, in my case, pretty much just an annoyance more than a real 'problem'.

    But since what I'm seeing does seem to be some sort of misconstructed mySQL query, or at least something that is causing the database to throw up an error in complaint, that doesn't mean that the same or a similar problem can't or won't crop up in other usage scenarios. I happened to figure out that I could force the one problem to occur by doing the 'save-and-continue', and chose to go down that road since it was very reproducible. And now I'm not sure how much further to go, since I don't know that much about the WP inner workings with mySQL, and would hesitate to make many changes in that area since it is the heart and soul of the code.

    Luckily, I've been doing most of the hacking on a local machine, not the machine my site is hosted on.

    When looking at Apache, PHP, and MySQL versions, don't forget to include the Zend Optimizer as well. My hosting company uses Zend, and I have seen it do funny things to parts of the older WP code.

  22. JPigford
    Member
    Posted 8 years ago #

    rdsmes, it most certainly is site crippling for me as no posts go through. After I click "Publish" it goes immediately to the actual site (outside of /wp-admin/) and gives a 404 error.

  23. rdsmes
    Member
    Posted 8 years ago #

    As it happens to me, when I hit 'publish', I too am returned to the 'site' and get a 404 error since the browser is attempting to access a page that doesn't exist (because the redirection URL is garbage). But if I click on 'home' or go to my site's home page, I find that the offending post did indeed get published, even though it didn't "feel" like it did.

  24. rdsmes
    Member
    Posted 8 years ago #

    Ok, here's the deal on my 404 problem, to the best of my knowledge, for any of the developer types that might want to look into this issue:

    I've been able to reproduce the problem reliably by starting a new post, then using the 'save and continue editing' button. When the page is being generated to send back to my browser, here's what happens:

    1) in edit-form-advanced.php, when generating the 'referredby' value, the url_to_postid function is called.

    2) toward the end of the function, the url_to_postid function generates a new WP_Query object.

    3) the WP_Query object calls its get_posts() function.

    4) After much ado, the get_posts function generates the first mySQL query through a call to $wpdb->get_results() That query IS SUCCESSFUL.

    5) However, further down in the get_posts function, the resulting $this->posts array is passed to the update_post_caches function.

    6) In the update_post_caches function, the $posts array is found to be non-empty. For the next mySQL query, the $post_id_array is 'imploded' to form the $post_id_list. But the resulting $post_id_list IS EMPTY. When this empty $post_id_list is passed as the parameter for the IN() section of the next mySQL query (comment "Get post-meta info"), mySQL complains (most likely) about the IN parameters being empty. This causes the wpdb object to print_error, and the output of that print error finds its way all the way back to the beginning of this story, in the 'referredby' field of the page sent back to the browser, and ultimately into the redirection URL on a 'save' or 'publish' operation. That garbage in the URL causes the 404.

  25. vkaryl
    Member
    Posted 8 years ago #

    This is turning into one of those things that needs a post to the wp-testers list....

    wp-testers@lists.automattic.com

  26. rdsmes
    Member
    Posted 8 years ago #

    If anybody has the guts to try a quick patch / workaround for this problem - for those running maybe a local test server or something like that, you could give this a try:

    Edit file wp-includes\functions.php. On line 1413, in the update_post_caches routine, you'll see:

    $post_id_list = implode(',', $post_id_array);

    Add a check after that line, so that it looks like this:

    $post_id_list = implode(',', $post_id_array);

    if (empty ($post_id_list))
    return;

    I've run that patch on my test machine now, and it seems to have cleared up the 404 problem that I was able to reproduce on demand by using the 'save and continue' button. I'm sure, for the developers out there, that THIS IS NOT the preferred solution. But it may get you up and running.

    It's up to you if you'd like to give it a shot. I can't guarantee that there won't be ill effects, but the fix just really detects a condition that was causing a query to fail anyway.

    I've done about all I can do to pin this one down. I'll play with this patch for a while and see how it goes.

  27. rdsmes
    Member
    Posted 8 years ago #

    Like I said in the other thread, I don't visit this site that much, so I wasn't sure how to submit bug reports, and I don't see a link anywhere.

  28. sparkiem
    Member
    Posted 8 years ago #

    I cured my problem about the 404 when clicking publish or edit by disableing the pingomatic feature. Go to options then writing and it is at the bottom of page. Afte this I have not seen the 404 error, I have tested about 25 times.
    Go here to view my blog. http://www.grandfatherclocksplus.net/blogging

  29. plainsman
    Member
    Posted 8 years ago #

    May I request a this be made a sticky until the problem is fixed?

    I have been getting this with the last 2.0 and 2.0.1 ... was just being patient waiting for a stable version.

    It is a problem. I have numerous students and others using the latest veresion and it has been a problem for all of them.

  30. vkaryl
    Member
    Posted 8 years ago #

    rdsmes -

    bug reports to http://trac.wordpress.org/ - be sure you look through the current listings to make sure it's not already there....

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags