[RAW FIX] - VirtueMart - Error 500 nell'upload images

March 9, 2009

Programming , Tips and Tricks

Even on this occasion that the public is not a real fix but a way of "primitive" to get around the problem and ensure the operation of the application.

In this case we speak of the component " Virtuemart "Joomla CMS that allows you to transform into an online store. In some hosting due to the configuration of the "CGI Timeout" set in Apache can make errors "500 Internal Server Error" during the addition of new images for a product.

This is because when you load the interface to upload the Virtuemart performs a check of all files and folders in the default image. If, then, there are many files the script does not finish in time verification of each file by going into error "CGI Timeout".

In my current hosting this timeout is set to 60 seconds and then I proceeded to directly edit the source code for Virtuemart to make sure it does not run that occurs regardless of how many files are present in the default folder.

To do this you must open the file "product.file_form.php" in this path:

<root_di_Joomla> / administrator / components / com_virtuemart / html /

and then stand on the line 105 which will appear as follows:

  vmReadDirectory ( DOWNLOADROOT , '.' , true ) ; DownloadRootFiles vmReadDirectory = $ (DOWNLOADROOT, '.', True); 

and change it by changing the parameter to "true" to "false" as below:

  vmReadDirectory ( DOWNLOADROOT , '.' , false ) ; DownloadRootFiles vmReadDirectory = $ (DOWNLOADROOT, '.', False); 

In this way the problem dell'error "500 Internal Server Error" in the process of uploading files is solved.

I should point out that the version of Virtuemart on which I made ​​those changes is the 1.1.3.

I'm available for any clarification or if after such changes are found other kinds of problems.

[11/03/2009 - 00:40] UPDATE # 1: I did some testing to validate the reason for this change and I report directly to the code of the entire function "vmReadDirectory" taken from the original file "ps_main.php"

  / ** 
  * Utility function to read the files in a directory 
  * @ Param string The file system path 
  * @ Param string A filter for the names 
  * @ Param boolean Recurse search into sub-directories 
  * @ Param boolean True if to prepend the full path to the file name 
  * /
 $path , $filter = '.' , $recurse = false , $fullpath = false ) { vmReadDirectory function ($ path, $ filter = '.', $ recurse = false, $ fullpath = false) {
	 array ( ) ; $ Arr = array ();
	 !@ is_dir ( $path ) ) { if (@ is_dir ($ path)) {
		 ; return $ arr;
	 }
	 opendir ( $path ) ; $ Handle = opendir ($ path);

	 $file = readdir ( $handle ) ) { while ($ file = readdir ($ handle)) {
		 vmPathName ( $path . '/' . $file , false ) ; VmPathName = $ dir ($ path. '/'. $ File, false);
		 is_dir ( $dir ) ; $ IsDir = is_dir ($ dir);
		 $file != "." ) & amp ;& amp ; ( $file != ".." ) ) { if (($ file! = ".") & amp; & amp; ($ file! = "..")) {
			 preg_match ( "/ $filter /" , $file ) ) { if (preg_match ("/ $ filter /", $ file)) {
				 $fullpath ) { if ($ fullpath) {
					 = trim ( vmPathName ( $path . '/' . $file , false ) ) ; $ Arr [] = trim (vmPathName ($ path. '/'. $ File, false));
				 { Else {}
					 = trim ( $file ) ; $ Arr [] = trim ($ file);
				 }
			 }
			 $recurse & amp ;& amp ; $isDir ) { if ($ recurse & amp; & amp; $ isDir) {
				 vmReadDirectory ( $dir , $filter , $recurse , $fullpath ) ; $ Arr2 = vmReadDirectory ($ dir, $ filter, $ recurse, $ fullpath);
				 array_merge ( $arr , $arr2 ) ; $ Arr = array_merge ($ arr, $ arr2);
			 }
		 }
	 }
	 $handle ) ; closedir ($ handle);
	 $arr ) ; asort ($ arr);
	 ; return $ arr;
 } 

As explained in the comments of the same feature set to "false" the 3 rd parameter disables recursion avoiding the check of the files in subfolders are also carried out by generating the error Timeout (CGI timeout = 60 sec; max_execution_time = 120).

, , ,

About

I am a 28 year old geek, love computer science from the age of 7. Passionate about the web programming languages ​​and computer security. In 2007 I created this site to collect all that I learn every day in my work in an IT Department.

View all posts by capn3m0

2 Responses to "[RAW FIX] - VirtueMart - Error 500 nell'upload images"

  1. paranella Says:

    Thank you brother!

    Reply

Trackbacks / Pingbacks

  1. [RAW FIX] - JOOMLA - Error 500 "Media Management" (com_media) | capn3m0.org - Web & Security - October 21, 2009

    [...] Related Articles 2008 [RAW FIX] - VirtueMart - Error 500 nell'upload images [FIX] - JOOMLA - Expose Component - Login and Upload Problems [RAW FIX] Joomla GCalendar [...]

Leave a Reply

Stop SOPA