WordPress Upload Media to a post issue - wordpress

I'm struggling from an error on WordPress 3.8.1.
Whenever I try to upload a media to a post, it does not add, it says An error occurred in the upload. Please try again later..
But the weirder thing is that it is shown on dashboard/media/library even after this issue.
I also cannot see uploaded attached media to my posts (edit post / [add media button]) / media library / uploaded to this post, but in dashboard/media/library section , these old uploaded images are shown properly that which is uploaded to what post.
I have tried the followings:
Re-installed both my local version and en_US from both update manager and manually
Deleted wp-includes and wp-admin folders and replaced them manually.
I have checked chown and chmod of the wp-content/uploads folder. To make sure they are working, I have deleted wp-content/uploads/2014 folder, and after first upload that shows this error, the folder is created with right chown and chmod and files were there (wp-content/uploads/2014/01/26/file with resolutions.jpg)
I have deleted unneeded plugins, deactivated all plugins and themes, switched back to WordPress's default plugin, I have even reset active plugins json object at wp_options from SQL, did not help.
I have enabled php error logs, nothing related is shown
I have altered the WP_DEBUG definition to true, I have even defined WP_DEBUG_DISPLAY to true, no help.
When I try to add from wp-admin/media-new.php , using multi uploader, file is freezing at "Crunching…" step, but old browser upload works flawlessly.
I'm managing the VPS and hosting the blog myself with CentOS 6.5 x64. safe_mode is set as off. There is not a mod_security option in my php.ini. My upload_max_filesize in php.ini is set to 20M, memory_limit is 256M, only 3 sites are hosted and memory is quite empty while testing these. This also happens even with 50kb .jpg images, so this should not be related.
I have re-uploaded all wordpress files from a clean downloaded zip, no help.
I have tried adding AddType x-mapp-php5 .php .php4 to the end of .htaccess as suggested here, that did not help at all.
The thing is that, I have tried a clean installation to another domain on the same server, it is working as it should.
What could be the problem? How can I fix this?
Thanks in advance,

See if custom post type has any files that are in UTF-8. If you change it to ANSI, that should help, if thats an issue.

I had the same issue, and found that there is a problem with my theme itself... try doing the same action using the twentyten theme. if that works, then take a look and see if there is any conflicting code in the functions.php of the theme...
if you are using a child theme can I suggest making another child theme, or using an alternative them as in my experience not all themes "like" being used as a child...

If you are trying to upload into a custom post-type, change the capability_type setting in your functions.php file to 'post' and it should fix your problem.

Check permissions of your wp-content or wp-content/upload folders, If folder permission is not 755 then change it to 755 and re-upload again. I hope it will solve your problem.

If you are using a low scale server and added a plugin named "WP-SmushIt" then it will surely cause an error. Reason is simple this plugin uses CPU resources to minimize the size of images in process of optimizing it and so it crosses the server limited execution time. Solution is simple-> Go with higher plan servers or try changing server execution time listed in php config file.

Not directly related to this, but I have experienced the exact same issue after moving the very same site to a different server now. Only difference is now I've been using Nginx instead of Apache. I have checked the ownerships before and they were all correct (else the normal upload wouldn't work earlier either). I'm leaving this here just as a reference.
The fix on my newer case was simply changing the ownership of the web root and all the files inside.
Nginx and PHP5-FPM were running with same user: www-data, which is at the group with same name: www-data.
So changing of all the ownership of the files fixed in this case:
su
chown -R www-data:www-data /path/to/wordpress/root/
And the issue was gone.
I still don't know the original reason of my old issue, I had to wipe, start from clean and restore the posts, plugins etc. from scratch.

I was facing same issue in wordpress like media not loaded in popup. then i have resolved.
I think, Some times problem created by ajax response.Means ajax response comes with some additional content.
Wordpress media popup is loaded content by ajax(json Response) and ajax give response with some content like style and other.
For Example:-
<style>
.class{}
</style>
then json(ajax response).
So First check your ajax response in console.We have to disable all plugins then check it is work or not.If no then activate default theme. because content comes from plugin and theme.

check your folder permission, and mod_security settings, also try to increase max_execution_time and memory,

Related

Wordpress old/updated/deleted CSS files are being served minified and I cant delete them. Why?

Backstory
We are using a LAMP stack (bitnami) to run a multisite Wordpress instance. This is the second time I have ran into a file that will not update when we push an update (We use git and pull the latest changes to the bitnami server).
We have noticed that when deleting (renaming for that matter) the file, it can still be retrieved by performing a GET on the resource (or the url in a browser). Also, if we were trying to make changes the changes do not come with the file - it is still the old file. Interestingly enough, the file is minified, which because of issues with this in the past we do not use any plugins that minify our CSS. So there should be no reason for it to be minified.
We have WP Total Cache - clearing all caches is successful but does not stop this from happening. (We used to use WP Super Cache, when this bug happened we decided to change plugins to WP Total Cache and purged the cache and it fixed the problem - but it is back and that no longer works).
I have also seen the trick where we can use a "?ver=###" query param on the url. This works but this would prevent us from using CloudFront for our files (currently disabled for all this testing so its not the problem either). Also I am not convinced it is a long term solution - or a solution at all since these minified files are being created and shouldnt be in the first place.
Additional information
It may not be helpful, but the files we have noticed this with are in a theme folder that is not technically an active theme. We just use the folder for additional resources that we have created ourselves. We reference them in the head of some pages.
Example:
/wp-content/themes/active-theme <- The active theme
/wp-content/themes/resources <- Our custom resources
Questions:
Where is this file being stored?
How can I delete it?
How can I prevent this from wasting our time ever again?
I found that the issue was with the bitnami server itself. The Apache2 module PageSpeed was causing the served files to be minified and cached resulting in the pages never updating no matter what we did on wordpress.
Apache:
To disable PageSpeed, comment out the following lines in your httpd.conf (/opt/bitnami/apache2/conf/httpd.conf)
#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf
Solution found here

Not Acceptable?

My site is running but I could not log in to admin dashboard, got this error
Not Acceptable!
An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.
After googling I found out it has to do with mod_security. I tried every approach to fix it: changed my plugin folder name, tried disabling mod_security with .htaccess but the error remains the same.
Are there other alternatives that I could take?
Difficult question! To be honest, I wouldn't try to fix it. I would suggest copying files and database to a local WordPress. If everything is running on you local machine, I would delete the WordPress server version and install a new WordPress and copy the database and all the files.
If you think of the hours, you try to fix it instead of copy the whole WordPress and install a new one.
please delete you .htaccess file from the root directory and try to login into wp-admin. Once login gets successfully then regenerate the .htaccess file.
For regenerate the .htaccess file you need to follow the below steps:
Go to setting -> permalink -> change permalink into default.
And save the setting.
After save setting then change permalink into the post.
Now you can see that the .htaccess file gets generated successfully.

WordPress website down

I'm new to programming & I have learned how to create websites using WordPress technology. I have created a website www.popstudio.in and it was working fine before.
Recently when I try to access the website, I get the following error.
The popstudio.in page isn’t working
popstudio.in is currently unable to handle this request.
HTTP ERROR 500
I have attached a screenshot, refer screenshot
Note:
This is WordPress based website.
I have renamed the plugins folder and still the website was down.
I have renamed the themes folder still the website was down.
Common Solutions for the 500 Internal Server Error.
The two most common causes of this error are a corrupted .htaccess file and exceeding your server’s PHP memory limit.
The .htaccess file in your WordPress directory can become corrupted after you install a plugin or make another change to your WordPress site. The fix is simple. All you need to do is create a new .htaccess file.
PHP memory limit issues often occur as the result of a poorly-coded plugin running on your site or a site that’s grown considerably over time and is using too many plugins. You’ll begin to exceed the PHP memory limits set by your hosting provider once either of these things happen. The result is a 500 internal server error.
Error 500 is a very generic error message. The information you're providing is not enough for someone here to help you.
The first place you want to look at is the log file. On an Apache server it is a file called error_log in the directory of your site.
You can check if your .htaccess file is properly configured.
Otherwise get in touch with your web host support!
Good luck
Have you tried to delete (after make a backup) the .htaccess file on the root path of the site? If it work, just resaved permalinks from the back-office after that.
Most of the 500 errors on WordPress are due to a problem with this file (corrupted, rights problem ...).
Go to wp-config.php and update it
define( 'WP_DEBUG', false);
to
define( 'WP_DEBUG', true );
Make sure that once you have found your issue, to return it back to 'false'. Just as a security 'best practice'.

WordPress 404 Errors

I moved a Wordpress website from one server to another and I am now getting 404 errors on everything but the home page.
I also checked that the .htaccess file is there and the database contents. They are fine. Not sure what else could be causing this.
Any ideas from the community?
Assuming you have pretty permalinks enabled, are you sure that the new server has mod-rewrite enabled? You can also check to see if this is the problem by going to a pagelike yoursite.com/?p=1 where 1 is a page id.
Assuming the URL has changed
You need to update either the database or (if you're lucky) one of the .php files in the wordpress distro - see the wordpress article on this.
I had the same issue and ended up having to edit the database. You're seeing the 404's because wordpress thinks it's still hosted at the old URL and is therefore trying to retrieve files from it.
If the URL has not changed
Perhaps permissions need updating on the folders? The folders should be set at 755 and the files 644 (reference here).
Looks like you may have solved the problem - I had a similar problem where permalinks would not work, but the default links did work. I modified the .htaccess file to what Wordpress said to do. Twice I thought I had solved the problem, but didn't.
I had moved it to my local Ubuntu Karmic Koala system for testing, and found that the solution involved editing a file in /etc/apache2/sites-enabled. On my system, it was called 000-default.
This file had statements like the .htaccess file, and in two places had AllowOverride None, which I had to change to AllowOverride All. Apparently, this file overrides any local .htaccess files.
I also had to change the location of Wordpress in the main configuration, but that was obvious.
I hope this will help someone who has tried all the normal suggestions like me, and is still having problems.

Permalinks not working for wordpress MU, images not showing up - .htaccess Problem

I moved 3 different wordpress installations to one single Wordpress MU.
Every thing except Permalinks are not working and images are not loading on the webpages.
Image URL style
http://subdomain.domain.com/files/2009/05/image.gif I get 404.
but if change i change it to wp-content/blogs.dir/4/files/2009/05/image.gif It works perfectly fine.
I tried almost everything with .htaccess file.
My mod_rewrite is active.
I am setting up this on an EC2 Instance.
Pls help.
Are you are using suPHP as your PHP handler? If so and you have all of your files set to executable, then this could trigger your problem.
Under suPHP you must have strict and secure file permissions (644 for files, 755 for directories) or else your site will not function as you intend it to. Using suPHP also runs php as the domain's user rather than nobody, which is another security gain.

Resources