5

For a client of mine, I have moved their webpage to a VPS by request. But I'm a web developer and not good at server configuration.

Due to a permission misconfiguration, in my opinion, I cannot fetch images in Media library, no error or sth. Also when I try to upload a new one, it completes the Uploading process, but gets stuck in Processing process and gives a 403 error on async-upload.php.

I have tried 755 and 777 permissions on both wp-content and wp-content/uploads, doesn't solve the issue.

Any help would be appreciated.

Edit: Logs added.

These are from requests.log

*.252.164.35 - - [20/Nov/2015:18:14:48 -0500] "GET /xml_feed/********.php HTTP/1.1" 200 1861
*.252.164.35 - - [20/Nov/2015:18:14:51 -0500] "GET /xml_feed/*****.php HTTP/1.1" 200 394
*.252.164.35 - - [20/Nov/2015:18:14:52 -0500] "GET /xml_feed/***.php HTTP/1.1" 200 359
*.253.241.91 - - [20/Nov/2015:18:14:50 -0500] "POST /wp-admin/async-upload.php HTTP/1.1" 200 11
*.253.241.91 - - [20/Nov/2015:18:14:53 -0500] "POST /wp-admin/async-upload.php HTTP/1.1" 403 3214

Edit 2: Gave all folders 777 permission, now I can re-install my WP setup and update my plugins from panel, but Media Library problem still exists, async-upload.php still gives 403 error.

yenerunver
  • 416
  • 1
  • 5
  • 26
  • Check the Apache log, usually in `/var/log/httpd` for clues. 403 means you are forbidden to view the resource. Also check for an htaccess file and the virtual host configuration in `/etc/httpd/conf` – Grasshopper Nov 20 '15 at 22:13
  • @Grasshopper thanks for reply. I edited my post, added logs. – yenerunver Nov 20 '15 at 22:59
  • @Grasshopper there is an IP difference between my xml_feed requests and WP's new media requests. Could it be the reason of the problem? – yenerunver Nov 20 '15 at 23:19
  • Gave all folders 777 permission, now I can re-install my WP setup and update my plugins from panel, but Media Library problem still exists, async-upload.php still gives 403 error. – yenerunver Nov 23 '15 at 02:07

3 Answers3

8

The issue for me was linked to an auto_increment issue on the database.

Here's what fixed it for me:

DELETE FROM wp_termmeta  WHERE meta_id=0;
DELETE FROM wp_terms  WHERE term_id=0;
DELETE FROM wp_term_taxonomy  WHERE term_taxonomy_id=0;
DELETE FROM wp_commentmeta  WHERE meta_id=0;
DELETE FROM wp_comments  WHERE comment_ID=0;
DELETE FROM wp_links  WHERE link_id=0;
DELETE FROM wp_options  WHERE option_id=0;
DELETE FROM wp_postmeta  WHERE meta_id=0;
DELETE FROM wp_users  WHERE ID=0;
DELETE FROM wp_posts  WHERE ID=0;
DELETE FROM wp_usermeta  WHERE umeta_id=0;

ALTER TABLE  wp_termmeta ADD PRIMARY KEY(meta_id);
ALTER TABLE  wp_terms ADD PRIMARY KEY(term_id);
ALTER TABLE  wp_term_taxonomy ADD PRIMARY KEY(term_taxonomy_id);
ALTER TABLE  wp_commentmeta ADD PRIMARY KEY(meta_id);
ALTER TABLE  wp_comments ADD PRIMARY KEY(comment_ID);
ALTER TABLE  wp_links ADD PRIMARY KEY(link_id);
ALTER TABLE  wp_options ADD PRIMARY KEY(option_id);
ALTER TABLE  wp_postmeta ADD PRIMARY KEY(meta_id);
ALTER TABLE  wp_users ADD PRIMARY KEY(ID);
ALTER TABLE  wp_posts ADD PRIMARY KEY(ID);
ALTER TABLE  wp_usermeta ADD PRIMARY KEY(umeta_id);

ALTER TABLE wp_termmeta CHANGE meta_id meta_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_terms CHANGE term_id term_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_term_taxonomy CHANGE term_taxonomy_id term_taxonomy_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_commentmeta CHANGE meta_id meta_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_comments CHANGE comment_ID comment_ID  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_links CHANGE link_id link_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_options CHANGE option_id option_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_postmeta CHANGE meta_id meta_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_users CHANGE ID ID  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_posts CHANGE ID ID  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE wp_usermeta CHANGE umeta_id umeta_id  BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;

As taken from here

trolologuy
  • 1,900
  • 4
  • 21
  • 32
  • Thanks. This fixed it for me, but I'd really like to know why. I tried looking in the code for what would throw the 403 header in response to the upload. The actual response was `-1` with an http response header 403. I was going crazy checking ownership and permissions, and searching the logs for clues that aren't there. – Altimus Prime Feb 13 '23 at 19:15
0

When I changed servers I used a find and replace in my DB for the folder structure /folder_name/public_html/blog -> /srv/www/html/blog. This tool works pretty good interconnect. I tried originally with find and replace in notepad but

SELECT * FROM wp_posts WHERE ID = '0' AND post_type = 'attachment';

OR

SELECT ID, COUNT(*) c FROM wp_posts GROUP BY ID HAVING c > 1;
Sam
  • 1,542
  • 2
  • 13
  • 27
S-Thomas
  • 41
  • 4
-18

It seems a misconfigured plugin causes this problem. Topic can be closed.

yenerunver
  • 416
  • 1
  • 5
  • 26