After just spending most of the day on this and this being one of the most frustrating issues i've come across with Drupal I thought i'd write a list of fixes for this Filefield AHAH 'HTTP error 0 occured' as it may help someone else. There are lots of suggestions on Drupal.org but it takes a lot of searching to go through them all.
My setup is running Drupal 6.22 with the Seven admin theme, PHP 5.3.5, Apache running on CentOS. The image and file modules i'm using are: ImageAPI 6.x-1.10, Filefield 6.x-3.10,ImageField 6.x-3.10, Filefield Paths 6.x-1.4.
Check Your Theme Scripts
<?php print $scripts; ?> <?php print $closure; ?> </body>
Update Your File and Image Modules
Some older versions of the filefield module had the AHAH section commented out, not sure why, but updating your modules to the most recent versions would be the first thing to check.
ImageAPI - http://drupal.org/project/imageapi
Filefield - http://drupal.org/project/filefield
Filefield Paths (probably not the problem but a handy module to have) - http://drupal.org/project/filefield_paths
Imagefield - http://drupal.org/project/imagefield
Also check that the permissions are correct on the folders and files in your sites/default/files directory.
Install the jquery update module to update to a newer version of Jquery - http://drupal.org/project/jquery_update. If that doesnt fix the problem then its probably best to disable this as it could cause issues elsewhere.
Check Your Upload Limits
This wasnt the cause of the problem for me but you should set this up even if you're not having problems. Setting post and upload sizes will limit the size of the file that can be uploaded which you will see when creating the image or file field in CCK. If your limit is too small, increase the post_max_size and upload_max_filesize to what you need. Increasing the memory_limit will allow for larger image processing and setting a longer max_execution_time gives scripts longer process and can fix a lot of WSOD errors.
In your php.ini add or modify:
post_max_size 2M upload_max_filesize 2M memory_limit 96M max_execution_time 120
OR if you dont have access to php.ini, In your .htaccess add:
<IfModule mod_php5.c> php_value post_max_size 2M php_value upload_max_filesize 2M php_value memory_limit 96M php_value max_execution_time 120 </IfModule>
Check FastCGI config
There's a MaxRequestLen value that can be set if you are using PHP as FastCGI in:
You may see this has been set to 128KB, change this to something a lot higher like 15mb:
SSH into your server and enter the following commands to install ImageMagick to process the images instead of PHP's built in GD2. ImageMagick-6.7.2-9 is the most recent version when writing this, you may want to visit ftp://ftp.imagemagick.org/pub/ImageMagick and check for the newest version. I'll keep this as ImageMagick-6.7.2-9 as I this is what i've installed and know it works.
tar xvfz ImageMagick-6.7.2-9.tar.gz
sudo make install
sudo ldconfig /usr/local/lib
Then you want to go to into Drupal admin /admin/settings/imageapi and set the image toolkit as Image Magick. I also had to go to configure and set the path to the convert binary as:
I then had open_basedir errors and so had to allow PHP to access the /usr/local/bin/convert directory. Locate your websites conf folder in the virtual host folder:
Then create a file in that folder called:
Add to the file:
<Directory /var/www/vhosts/yourdomain.com/httpdocs> php_admin_value open_basedir /var/www/vhosts/yourdomain.com/httpdocs/:/tmp/:/usr/local/bin/convert php_admin_value include_path /var/www/vhosts/yourdomain.com/httpdocs/:/tmp/:/usr/local/bin/convert </Directory>
Then you need to restart apache:
If you have any other solutions to this issue which doesnt fall under any of the above please post details in the comments.