Post by laszkris » Wed Oct 11, 2017 3:00 pm

Hello guys!
I"m used the 2.3 version and older but now i installed same server he 3.0.2.0 version of OC,
Is I try install or just upload any OCMOD zip or xml I got an error message like this:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/data1/S5-053/piac/parna/xxxxxxx.hu/admin/controller/marketplace/installer.php</b> on line <b>95</b>{"text":"Installing","next":"http:\/\/xxxxxxx.hu\/admin\/index.php?route=marketplace\/install\/install&user_token=yswS6xQqwkGPGY611mUiVEql5p8NMnUZ&extension_install_id=2"}

The hosting provider say the curl or other server module workinhg fine.
I"m looking any solution but i nothing fount until this time :(
The folders permission is ok.
I hope anybody can help me here.
Thanks
Laszkris

Newbie

Posts

Joined
Wed Oct 11, 2017 2:51 pm

Post by straightlight » Tue Nov 14, 2017 5:36 am

See if this solution solves the issue: viewtopic.php?f=198&t=191871#p702931

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Cmcanuck » Sat Nov 18, 2017 2:46 am

straightlight wrote:
Tue Nov 14, 2017 5:36 am
See if this solution solves the issue: viewtopic.php?f=198&t=191871#p702931
Hello,

I'm having the same issue as that other fellow (same version, same error on the same line). I tried replacing the files as suggested in that link am now get these errors:

Code: Select all

2017-11-17 18:39:42 - PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/***.com/httpdocs/store/admin/controller/marketplace/installer.php on line 80
2017-11-17 18:39:42 - PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/***.com/httpdocs/store/admin/controller/marketplace/installer.php on line 95
2017-11-17 18:39:42 - PHP Warning:  move_uploaded_file(/var/www/vhosts/***.com/oc_storage/marketplace/DwxCxePI9R.tmp): failed to open stream: No such file or directory in /var/www/vhosts/***.com/httpdocs/store/admin/controller/marketplace/installer.php on line 154
2017-11-17 18:39:42 - PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpCUO7B9' to '/var/www/vhosts/***.com/oc_storage/marketplace/DwxCxePI9R.tmp' in /var/www/vhosts/***.com/httpdocs/store/admin/controller/marketplace/installer.php on line 154
The recursive permissions for the oc_storage folder is 777.

Newbie

Posts

Joined
Sat Nov 18, 2017 1:23 am

Post by straightlight » Sun Nov 19, 2017 1:21 am

In admin/controller/marketplace/installer.php file,

find:

Code: Select all

foreach ($files as $file) {
			if (is_file($file) && (filectime($file) < (time() - 5))) {
				unlink($file);
			}
			
			if (is_file($file)) {
				$json['error'] = $this->language->get('error_install');
				
				break;
			}
		}
		
replace with:

Code: Select all

if (is_resource($files)) {
foreach ($files as $file) {
			if (is_file($file) && (filectime($file) < (time() - 5))) {
				unlink($file);
			}
			
			if (is_file($file)) {
				$json['error'] = $this->language->get('error_install');
				
				break;
			}
		}
	}
		
Then, find:

Code: Select all

foreach ($directories as $directory) {
			if (is_dir($directory) && (filectime($directory) < (time() - 5))) {
				// Get a list of files ready to upload
				$files = array();
	
				$path = array($directory);
	
				while (count($path) != 0) {
					$next = array_shift($path);
	
					// We have to use scandir function because glob will not pick up dot files.
					foreach (array_diff(scandir($next), array('.', '..')) as $file) {
						$file = $next . '/' . $file;
	
						if (is_dir($file)) {
							$path[] = $file;
						}
	
						$files[] = $file;
					}
				}
	
				rsort($files);
	
				foreach ($files as $file) {
					if (is_file($file)) {
						unlink($file);
					} elseif (is_dir($file)) {
						rmdir($file);
					}
				}
	
				rmdir($directory);
			}
			
			if (is_dir($directory)) {
				$json['error'] = $this->language->get('error_install');
				
				break;
			}		
		}
replace with:

Code: Select all

if (is_resource($directories)) {
foreach ($directories as $directory) {
			if (is_dir($directory) && (filectime($directory) < (time() - 5))) {
				// Get a list of files ready to upload
				$files = array();
	
				$path = array($directory);
	
				while (count($path) != 0) {
					$next = array_shift($path);
	
					// We have to use scandir function because glob will not pick up dot files.
					foreach (array_diff(scandir($next), array('.', '..')) as $file) {
						$file = $next . '/' . $file;
	
						if (is_dir($file)) {
							$path[] = $file;
						}
	
						$files[] = $file;
					}
				}
	
				rsort($files);
	
				foreach ($files as $file) {
					if (is_file($file)) {
						unlink($file);
					} elseif (is_dir($file)) {
						rmdir($file);
					}
				}
	
				rmdir($directory);
			}
			
			if (is_dir($directory)) {
				$json['error'] = $this->language->get('error_install');
				
				break;
			}		
		}
	}
This should rectify the problem.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Sun Dec 31, 2017 4:11 am

straightlight wrote:
Sun Nov 19, 2017 1:21 am
In admin/controller/marketplace/installer.php file,
find:
I also made those changes in 3.0.2, as you told us.. but now I'm getting another error when trying to upload and install an ocmod zip extension:
it uploads only about 50% and then stops and says: can't find this file !
The error text is not in a popup window

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sun Dec 31, 2017 4:14 am

it uploads only about 50% and then stops and says: can't find this file !
This error message does not exist among the core of Opencart. What is the exact and precise error message you are receiving upon upload? Since it is also uploading at 50%, in this case, what does the most recent access log error entry reports about? More information needed.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Sun Dec 31, 2017 4:31 am

straightlight wrote:
Sun Dec 31, 2017 4:14 am
What is the exact and precise error message you are receiving upon upload? Since it is also uploading at 50%, in this case, what does the most recent access log error entry reports about? More information needed.
ok, I had other Admin language and I translated the error text.
Now, in English it is: Install file could not be found!

Attachments

ocmod Capture.JPG

ocmod Capture.JPG (61.96 KiB) Viewed 5722 times


New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sun Dec 31, 2017 4:35 am

Ensure your system/storage folder is outside your public_html folder. Then, edit your config.php and admin/config.php file's DIR_STORAGE new destination as well from your .htaccess file (if found in your .htaccess file).

Then, from your admin - > systems - > settings - > edit settings - > FTP tab's upload path points to: public_html/ . Clear your OC admin dashboard cache as well as your admin - > extensions - > modifications - > refresh button.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Sun Dec 31, 2017 4:44 am

straightlight wrote:
Sun Dec 31, 2017 4:35 am
Ensure your system/storage folder is outside your public_html folder.
yes it is
Then, edit your config.php and admin/config.php file's DIR_STORAGE new destination
already did that
as well from your .htaccess file (if found in your .htaccess file).
?
what to edit in htaccess file ?
I find only this line: RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
How shall I change it ?
Then, from your admin - > systems - > settings - > edit settings - > FTP tab's upload path points to: public_html/ .
I don't have such setting.. I think it was in Opencart 2..?

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sun Dec 31, 2017 4:45 am

PM sent.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Sun Dec 31, 2017 5:03 am

straightlight wrote:
Sun Dec 31, 2017 4:45 am
PM sent.
thanx.
For the record.. after the 50% install attempt, the extension remains down in the list..

Attachments

50% install attempt Capture.JPG

50% install attempt Capture.JPG (74.46 KiB) Viewed 5695 times


New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sun Dec 31, 2017 7:12 am

Case resolved. Issue caused by the tmp folder on root FTP not being able to write any data since the past 15 days even with full writable permission. Issue needs to be resolved by the host.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Thu Jan 04, 2018 5:15 pm

unfortunenatly is not resolved -I still can't install extensions..
The hosting gave us a lot of support, but didn't find anything.

I think it's an error from moving the storage outside the public folder.
I don't now what was not modified during that move and where

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Thu Jan 04, 2018 6:37 pm

As mentioned over PM and on my previous reply, the issue is likely with the tmp folder on your FTP root folder. If your host is unable to resolve this simple issue, I would suggest to look for another webhost especially if you either don't have access to SSH or if you do have access to SSH and it would be insisted to troubleshoot this small issue by yourself since FTP permissions, in this case, does not seem to be enough.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Thu Jan 04, 2018 8:43 pm

well, I'm caught in the middle. ;)
The hosting company says there are no SSH problems, also no problem with the tmp folder: the zip ocmod file is uploaded to the tmp folder, but with the unzipping seems to be a problem and an error occurs -can;t create a tmp file in /storage/uploads/ (where the permissions also seem to be ok).
Remember, the install process starts, but breaks at 50%.

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Fri Jan 05, 2018 5:46 am

There are no frequent reports about installing an OCMod once the storage folder is outside the public_html folder normally. I would suggest to look for another host at this point if they indicate that the tmp folder has no issue since there was a discrepancy of 15 days when I checked that folder.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Fri Jan 05, 2018 3:50 pm

straightlight wrote:
Fri Jan 05, 2018 5:46 am
There are no frequent reports about installing an OCMod once the storage folder is outside the public_html folder normally.
the hosting company installed a second instance of Opencart 3 on the same site, but didn't move the storage folder (we still receive the popup to move..).
Without moving the storage folder, the extensions can all be uploaded, installed and also work properly..

Something went wrong during the storage moving.. an error occured. But I don't know now where to look and fix it.

Shall I try a re-installation of Opencart ?

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sat Jan 06, 2018 6:00 am

Without moving the storage folder, the extensions can all be uploaded, installed and also work properly..
If everything is working as it should, there is no need to reinstall the platform.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by infocondens » Sun Jan 07, 2018 5:51 pm

straightlight wrote:
Sat Jan 06, 2018 6:00 am
If everything is working as it should, there is no need to reinstall the platform.
well, it didn't work as it should, 'cause I could not install any ocmod Extension.

So, I reinstalled the whole Opencart 3.0.2.
Important: I didn't do the automatic move of the storage folder -I moved the folder manually.
Now everything works (..for the moment), I can install extensions, etc.

New member

Posts

Joined
Sat Sep 27, 2014 8:18 pm


Post by straightlight » Sun Jan 07, 2018 8:23 pm

Nowhere to be said on the above that the automatic move was needed. Although, thanks for the feedback to indicate this issue has now been resolved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot] and 107 guests