Jump to content
Jack_mcs

SiteMonitor

Recommended Posts

Jack, I was just curious, is it possible to include a sleep_time to avoid this annoying Fatal error: Maximum execution time of 30 seconds exceeded ? One one of my servers, I keep getting this error with so many larger directories excluded.


Absinthe Original Liquor Store

Share this post


Link to post
Share on other sites

Jack, I was just curious, is it possible to include a sleep_time to avoid this annoying Fatal error: Maximum execution time of 30 seconds exceeded ? One one of my servers, I keep getting this error with so many larger directories excluded.

You can insert sleep statements wherever you like and it may work. Some servers won't allow that to work as a way around the time but others will. But that is what the instances are for. You may want to try doing it that way.

Share this post


Link to post
Share on other sites

A little hint what would be the best place to insert it...?

In the runSitemonitor function in admin/includes/functions/sitemonitor_functions.php file, add one before each section, which are indicated by a statement like /************** SEE IF THERE ARE ANY NEW FILES ****************/

Share this post


Link to post
Share on other sites

Not sure if that is going to work without complicated function, adding just sleep(15); didn't work (500 error). So, I guess that using similar to this would have to be done:

 

define('sleep_time',2);
protected function serverUnload( &$iteration_time, &$script_slept ) {
// Stop server overloading
 if ( ( microtime( true ) - $iteration_time ) >= $this->allowed_time_before_sleep ) {
   sleep( $this->sleep_time );
	$script_slept += $this->sleep_time;
   ini_get( 'safe_mode' ) ? null : set_time_limit( $this->script_time_limit );
   $iteration_time = microtime( true );
   }
  }

 

Just an idea anyway... I'm aware about instances but I thought that this might also work, no need to run twice or more times...

Edited by mr_absinthe

Absinthe Original Liquor Store

Share this post


Link to post
Share on other sites

Not sure if that is going to work without complicated function, adding just sleep(15); didn't work (500 error). So, I guess that using similar to this would have to be done:

 

define('sleep_time',2);
protected function serverUnload( &$iteration_time, &$script_slept ) {
// Stop server overloading
 if ( ( microtime( true ) - $iteration_time ) >= $this->allowed_time_before_sleep ) {
   sleep( $this->sleep_time );
	$script_slept += $this->sleep_time;
   ini_get( 'safe_mode' ) ? null : set_time_limit( $this->script_time_limit );
   $iteration_time = microtime( true );
   }
  }

 

Just an idea anyway... I'm aware about instances but I thought that this might also work, no need to run twice or more times...

That code references a class, which doesn't exist. Besides, it is just excuting the same sleep statement so will most likely fail too. An internal server error shouldn't occur with that command. I suspect it is due to the function missing on your server, or something like that. You should try creating a file with just the sleep command in it and try to access that file via the web, like ...com/test_sleep.php. If it fails, it is a server issue.

Share this post


Link to post
Share on other sites

Hi,

 

I know there is already few questions answers about "Your username is invalid." but none if working for me

 

the error i got

 

error.gif Your username is invalid. Please change it and try again.: System -> /home/hende/public_html/ - SiteMonitor -> /home/hende/public_html/

 

can you help me please? thx

Share this post


Link to post
Share on other sites

the error i got

 

error.gif Your username is invalid. Please change it and try again.: System -> /home/hende/public_html/ - SiteMonitor -> /home/hende/public_html/

That only occurs on old versions. You should update to the latest version.

Share this post


Link to post
Share on other sites

Hi

 

I appear to have successfully set this up the only error message I am getting is

 

Failed to open file sitemonitor_db_reference.txt.

 

I have not got this file I assume it is written by the programme.

 

the error log for the site gives

 

[Mon Apr 30 09:25:58 2012] [error] [client XXX.XX.X.XX] PHP Warning: unlink(sitemonitor_reference_0.txt): Permission denied in /var/www/html/xxxxxxxxxxxxxxxxxx.co.uk/catalog/xxxxxxx*admin/sitemonitor_admin.php on line 101, referer: http://xxxxxxxxxxx/catalog/xxxxxxx*admin/sitemonitor_admin.php

[Mon Apr 30 09:25:58 2012] [error] [client XXX.XX.X.XX] PHP Warning: opendir(/var/www/html/xxxxxxxxxxxxxxxxxx.co.uk/catalog/xxxxxxx/images/cursors): failed to open dir: Permission denied in /var/www/html/xxxxxxxxxxxxx.co.uk/catalog/xxxxxxxxxx*admin/includes/functions/sitemonitor_functions.php on line 343, referer: http://xxxxxxxxxx/catalog/xxxxxxxxxx*admin/sitemonitor_admin.php

 

the image file is set to read and write can you say what other files/directories have to have their permissions changed as I do not wish to change permissions on unnessary files/directories?.

 

Thanks

Share this post


Link to post
Share on other sites

Hi

 

I appear to have successfully set this up the only error message I am getting is

 

Failed to open file sitemonitor_db_reference.txt.

 

I have not got this file I assume it is written by the programme.

 

the error log for the site gives

 

[Mon Apr 30 09:25:58 2012] [error] [client XXX.XX.X.XX] PHP Warning: unlink(sitemonitor_reference_0.txt): Permission denied in /var/www/html/xxxxxxxxxxxxxxxxxx.co.uk/catalog/xxxxxxx*admin/sitemonitor_admin.php on line 101, referer: http://xxxxxxxxxxx/catalog/xxxxxxx*admin/sitemonitor_admin.php

[Mon Apr 30 09:25:58 2012] [error] [client XXX.XX.X.XX] PHP Warning: opendir(/var/www/html/xxxxxxxxxxxxxxxxxx.co.uk/catalog/xxxxxxx/images/cursors): failed to open dir: Permission denied in /var/www/html/xxxxxxxxxxxxx.co.uk/catalog/xxxxxxxxxx*admin/includes/functions/sitemonitor_functions.php on line 343, referer: http://xxxxxxxxxx/catalog/xxxxxxxxxx*admin/sitemonitor_admin.php

 

the image file is set to read and write can you say what other files/directories have to have their permissions changed as I do not wish to change permissions on unnessary files/directories?.

 

Thanks

The code is trying to create that file but is not able to. You need to show the error to your host. They'll probably need to change the ownereship of the admin directory.

Share this post


Link to post
Share on other sites

Hi I just installed SiteMonitor and it works great. I just have one small problem when I got into the admin section of my site and click on SiteMonitor tab I get this in red at the top of the page "error.gif WARNING: Your admin name is admin. That should be changed. " how do I fit this?

 

Cheers

Stan

Share this post


Link to post
Share on other sites

Hi I just installed SiteMonitor and it works great. I just have one small problem when I got into the admin section of my site and click on SiteMonitor tab I get this in red at the top of the page "error.gif WARNING: Your admin name is admin. That should be changed. " how do I fit this?

 

Cheers

Stan

 

Change the name of the adnim folder to something that is not easy to guess, using your hosts cpanel or equivalent. Once the file has been changed open both of your includes/configure files and alter the references to admin to your new folder name. It really is that simple. You may have to alter the file permissions before you can alter the configure files, just rememder to change them back to what they originally were.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Change the name of the adnim folder to something that is not easy to guess, using your hosts cpanel or equivalent. Once the file has been changed open both of your includes/configure files and alter the references to admin to your new folder name. It really is that simple. You may have to alter the file permissions before you can alter the configure files, just rememder to change them back to what they originally were.

 

 

All fixed up thank you so much I feel my site is a little safer now. :D

Share this post


Link to post
Share on other sites

HI I just tried to Delete Reference File Delete the reference file and create a new one. But when I clicked on the update button I get this error

Fatal error: Maximum execution time of 30 seconds exceeded in home/theaquar/public_html/tasa/includes/functions/sitemonitor_functions.php on line 635

So I had a look at line 635 and it is like this; $parts = explode(",", $path); is there a problem here if so what is the fix for it. I have also change the admin file name resently, not sure if the would have made a difference or not. Thanks for all you help

Cheers

Stan

Share this post


Link to post
Share on other sites

HI I just tried to Delete Reference File Delete the reference file and create a new one. But when I clicked on the update button I get this error

Fatal error: Maximum execution time of 30 seconds exceeded

When you use the first update button to delete the referene file, the code reads it in first. If the file is large enough that can cause the timeout. In that case, you will need to delete the sitemonitor_reference_X.txt file manually, where X is the instance number.

Share this post


Link to post
Share on other sites

HI,

 

I just installed Sitemonite For RC2,

 

getting this message when trying update the configure file for the first time.

 

Failed to open file /home/myshop/public_html/admin/sitemonitor_configure_0.txt

 

 

file permission is 666

 

 

any idea where is the error?

 

 

Thanks...

Share this post


Link to post
Share on other sites

HI,

 

I just installed Sitemonite For RC2,

 

getting this message when trying update the configure file for the first time.

 

Failed to open file /home/myshop/public_html/admin/sitemonitor_configure_0.txt

 

 

file permission is 666

 

 

any idea where is the error?

Be sure that that is the correct path to the file, which should be present. You can verify that by looking at the path in the admin->Modules->Payment 9below the modules).

Share this post


Link to post
Share on other sites

A new version has been uploaded with the following changes:

 

- Added a link to quickly delete the reference an db reference files.

- Added code to check for the existence of an .htaccess file in the includes directory.

- Explanded startup file checking code to check for six types instead of two in the images directory.

- Changed hacker test to skip certain legitimate cases where eval is part of the name. Removes a lot false results from the test.

- Changed initial file checking for the images directory so empty entries are ignored.

- Corrected mistake in 2.9 -> 3.0 update instructions found by user razeryokes.

- Corrected messageStack code in sitemonitor_admin.php.

- Fixed log code. It wasn't truncating logs correctly.

Share this post


Link to post
Share on other sites

I just installed the latest version 3.2 on an RC2A instance. The Delete Reference File worked without error. The Execute Sitemonitor had 2 differences which are expected. But when I run the Manually Execute Sitemonitor, the following error occurs:

 

Warning: opendir(/home/username/public_html) [function.opendir]: failed to open dir: No such file or directory in /home/content/l/e/l/xxxxxxx/html/xxxxx/includes/functions/sitemonitor_functions.php on line 364

 

Not sure why it's not picking up the correct start directory? When I go back into Configure everything appears to be correct. When I open the sitemonitor_configure_0.txt file it still contains the defaults. Where is the configuration information stored?

Share this post


Link to post
Share on other sites

Never mind... it appears that I had FILENAME_SITEMONITOR_CONFIGURE set to .PHP instead of .TXT. Everything is working fine. Nice product :)

Share this post


Link to post
Share on other sites

Hi Jack,

 

I'm using your great contrib, but unfortunatelly my provider has disabled mail function for security reasons. Is there a way to use other mail contribs? I'm using PHPMailer Class in the store...

 

Thanks

Share this post


Link to post
Share on other sites

I'm using your great contrib, but unfortunatelly my provider has disabled mail function for security reasons. Is there a way to use other mail contribs? I'm using PHPMailer Class in the store...

Yes, but it isn't something I offer support for. But one would normally only have to include the class file, create an instance of the class and change the tep_mail line in the code to get it to work, assuming the email class you have installed is working correctly. If email is disables then the change must have been made to your checkout_process.php file or your customers would not receive emails. So you can check there to see how it is done.

 

--> Stepping up on soapbox

In my opinion, it is nonsense for a host to do that. I suspect what happened was that they were getting bombarded with emails sent from hackers using the tell a friend and other form pages and instead of having the sites on the server fix the problem, they just turned it off. I'm always of the opinion that if you have to change your sites basic functions to work with a particular host, then you should switch hosts.

--> Rant completed :)

Share this post


Link to post
Share on other sites

Thanks Jack,

I'll have a look...

 

I'm just a bit confused about the change to do in tep_mail line, because I can't find any tep_mail being used in your contribution. There is although a mail line around line 1169 in the file sitemonitor_functions.php:

   if ($ttlErrors || $always_email) {
    mail($to, 'Site Monitor Results', $msg, $from);
    if ($verbose)
	    echo 'Email sent to shop owner.' .'<br>';
   }

 

Unless you are talking about other tep_mail line...

Share this post


Link to post
Share on other sites

Hi again Jack,

 

I managed to use PHPmailer class to send the emails.

For other people using the same contrib (http://addons.oscommerce.com/info/7226), here is what I changed on admin/includes/functions/sitemonitor_functions.php:

Find:

if ($ttlErrors || $always_email) {
		mail($to, 'Site Monitor Results', $msg, $from);
		if ($verbose)
				echo 'Email sent to shop owner.' .'<br>';
}

Replace by:

if ($ttlErrors || $always_email) {
	  // include server parameters
	  require('includes/configure.php');
	  $server=DB_SERVER;			  # host name of server running MySQL
	  $user=DB_SERVER_USERNAME;	   # existing login username for mysql
	  $password=DB_SERVER_PASSWORD; # login password for mysql username
	  $dbname=DB_DATABASE;			# name of existing database to use
	  // Connect to database and get all config values.
	  $config_values="";
	  $dbconn=@mysql_connect($server,$user,$password) or http_headers('','Error,Database Connection');
	  @mysql_select_db($dbname,$dbconn) or http_headers('','Error,Database Connection');
	  $sql="select configuration_key as cfgKey, configuration_value as cfgValue from configuration where configuration_group_id='12' or configuration_group_id='1'";
	  $result=@mysql_query($sql,$dbconn) or http_headers('','Error,Database Connection');
	  while ($row = @mysql_fetch_array($result)) {
		if ($row['cfgKey'] != "LAST_HASH") $config_values.=$row['cfgKey'].'='.$row['cfgValue'];  // To be fed to hashing function.
		  define($row['cfgKey'], $row['cfgValue']);
	  }
	if(EMAIL_USE_PHPMAILER == 'true')
	{
	  require(DIR_WS_FUNCTIONS . 'general.php');
	  require_once(DIR_WS_CLASSES . 'phpmailer/class.phpmailer.php');
	  tep_mail($to, $to, 'Site Monitor Results' . ' - ' . STORE_NAME, $msg, $from, $from);
	}
	else {
	  mail($to, 'Site Monitor Results', $msg, $from);
	}
	if ($verbose)
		echo 'Email sent to shop owner.' .'<br>';
}

 

I had also the change the $from string in the sitemonitor_configure_0.txt (as for other instances if they exist) from:

$from = 'From: some_address@your_domain.com'; //where email is sent from

to:

$from = 'some_address@your_domain.com'; //where email is sent from

as I got an error saying:

Invalid address: From: some_address@your_domain.com

Of course I changed some_address@your_domain.com to my real email address...

This last change can also be performed on sitemonitor_functions.php for any new configuration files to be created using the right string.

 

Enjoy!

Share this post


Link to post
Share on other sites

Jack, in a 2.3.1 shop in Sitemonitor V3.2>Admin>Manually Execute Sitemonitor, after clicking the update button I get this:

 

 

Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /home/myname/public_html/myshopsadmin/includes/functions/sitemonitor_functions.php on line 296

 

This only occur with php 5.3.13; when I toggle the shop over to php version 5.2 the warning is not there.

 

I have this:

 

// set default store time zone

 

ini_set('date.timezone', 'America/New_York');

 

in the shops application_top.php file.

 

Any ideas on this?

 

Thanks

Edited by altoid

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×