If this is your first visit, check our documentation. To post, register or login.
Forums / Business Issues / Other Business Topics / Excessive PHP warnings

Excessive PHP warnings

Started by lordzoabar on 2 Jan 2018, 8:18 PM · Views: 229

Results 1 to 20 of 21
2 Jan 2018, 8:18 PM
#1
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Excessive PHP warnings

We've recently lost all contact with our usual Zen Cart Support Specialist, and in switching over to being more self-reliant, our store has been generating quite a few error logs, with a worrying number of PHP errors cropping up. I've managed to work may way through, and have cleaned up the fatal warnings we had, but there's a good many that I am just not that familiar with. Below is one of the shorter lists I've gotten, all of which are repeated in the longer ones. If anyone could take a look and let me know what is actually going on, it would give me a good start at streamlining our site.

[02-Jan-2018 13:40:10 America/New_York] Request URI: /, IP address: ..*.

#1 scandir() called at [/home//public_html/includes/init_includes/init_zx_product_sorter.php:38]
#2 require(/home/
/public_html/includes/init_includes/init_zx_product_sorter.php) called at [/home//public_html/includes/autoload_func.php:48]
#3 require(/home/
/public_html/includes/autoload_func.php) called at [/home//public_html/includes/application_top.php:170]
#4 require(/home/
/public_html/includes/application_top.php) called at [/home/********/public_html/index.php:26]

[02-Jan-2018 13:40:10 America/New_York] PHP Warning: scandir(DIR_FS_ADMINincludes/installers/zx_product_sorter): failed to open dir: No such file or directory in /home/********/public_html/includes/init_includes/init_zx_product_sorter.php on line 38

[02-Jan-2018 13:40:10 America/New_York] PHP Warning: scandir(): (errno 2): No such file or directory in /home/********/public_html/includes/init_includes/init_zx_product_sorter.php on line 38

[02-Jan-2018 13:40:10 America/New_York] PHP Warning: sort() expects parameter 1 to be array, boolean given in /home/********/public_html/includes/init_includes/init_zx_product_sorter.php on line 43

[02-Jan-2018 13:40:11 America/New_York] Request URI: /, IP address: ..*.

#1 error_log() called at [/home//public_html/includes/modules/footer.php:19]
#2 require(/home/
/public_html/includes/modules/footer.php) called at [/home//public_html/includes/templates/westminster_new/common/tpl_footer.php:21]
#3 require(/home/
/public_html/includes/templates/westminster_new/common/tpl_footer.php) called at [/home//public_html/includes/templates/westminster_new/common/tpl_main_page.php:344]
#4 require(/home/
/public_html/includes/templates/westminster_new/common/tpl_main_page.php) called at [/home/********/public_html/index.php:97]

[02-Jan-2018 13:40:11 America/New_York] PHP Warning: error_log(/home/webadmin//html/cache/page_parse_time.log): failed to open stream: No such file or directory in /home//public_html/includes/modules/footer.php on line 19

2 Jan 2018, 8:29 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Excessive PHP warnings

It appears that your DIR_FS_ADMIN definition has "gone missing"; that's at least where the following error arises.

[02-Jan-2018 13:40:10 America/New_York] PHP Warning:   scandir(DIR_FS_ADMINincludes/installers/zx_product_sorter): failed to  open dir: No such file or directory in  /home/********/public_html/includes/init_includes/init_zx_product_sorter.php  on line 38
2 Jan 2018, 9:08 PM
#3
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

You know, as useful as Product Sorter is, it also accounts for half the errors I get in the first place. I just completely uninstalled it, and deleted all files regarding it, and it took my latest error-log-generation from 6 pages down to 3, which I've consolidated further into just one. This is what I've got left now. (This isn't counting WordPress specific errors.)

[02-Jan-2018 16:13:34 America/New_York] Request URI: /framesh0p/login.php?camefrom=index.php, IP address: ..*.

#1 error_log() called at [/home/********/public_html/framesh0p/includes/classes/logger.php:46]

#2 logger->write() called at [/home/********/public_html/framesh0p/includes/classes/logger.php:34]

#3 logger->timer_stop() called at [/home/********/public_html/framesh0p/includes/functions/general.php:23]

#4 zen_redirect() called at [/home/********/public_html/framesh0p/login.php:37]

[02-Jan-2018 16:13:34 America/New_York] PHP Warning: error_log(/home/webadmin//html/cache/page_parse_time.log): failed to open stream: No such file or directory in /home//public_html/framesh0p/includes/classes/logger.php on line 46

[02-Jan-2018 16:13:36 America/New_York] Request URI: /framesh0p/index.php, IP address: ..*.

#1 error_log() called at [/home/********/public_html/framesh0p/includes/classes/logger.php:46]

#2 logger->write() called at [/home/********/public_html/framesh0p/includes/classes/logger.php:34]

#3 logger->timer_stop() called at [/home/********/public_html/framesh0p/includes/application_bottom.php:17]

#4 require(/home//public_html/framesh0p/includes/application_bottom.php) called at [/home//public_html/framesh0p/index.php:43]

[02-Jan-2018 16:13:36 America/New_York] PHP Warning: error_log(/home/webadmin//html/cache/page_parse_time.log): failed to open stream: No such file or directory in /home//public_html/framesh0p/includes/classes/logger.php on line 46

[02-Jan-2018 16:13:39 America/New_York] Request URI: /, IP address: ..*.

#1 error_log() called at [/home/********/public_html/includes/modules/footer.php:19]

#2 require(/home//public_html/includes/modules/footer.php) called at [/home//public_html/includes/templates/westminster_new/common/tpl_footer.php:21]

#3 require(/home//public_html/includes/templates/westminster_new/common/tpl_footer.php) called at [/home//public_html/includes/templates/westminster_new/common/tpl_main_page.php:344]

#4 require(/home//public_html/includes/templates/westminster_new/common/tpl_main_page.php) called at [/home//public_html/index.php:97]

[02-Jan-2018 16:13:39 America/New_York] PHP Warning: error_log(/home/webadmin//html/cache/page_parse_time.log): failed to open stream: No such file or directory in /home//public_html/includes/modules/footer.php on line 19

3 Jan 2018, 3:32 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Excessive PHP warnings

Might want to double check at least two things/aspects:

  1. the cache directory exists.
  2. the permission level for the cache directory. Typically would expect 755 at least, but recently seems like various server admins do their own thing. :)
    What ZC version is involved? Php version asseen by zc?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

3 Jan 2018, 4:40 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Excessive PHP warnings

You can also turn off page-parse times in Admin->Configuration->Logging.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Jan 2018, 5:03 AM
#6
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

The cache exists, but for some reason, everything gets sent to logs instead. I suppose that setting will either be under Logging as well, or in the error_logging.php directly. ZC is 1.5.5d, and php I’ve managed to get stable at 5.6. I’ve got the server updated (finally), to be able to support up to 7.2, but anything higher than 5.6 breaks half of the storefront, and, for what it’s worth, completely erases our production/inventory system we use for our in-house work (We’re a custom framing/photo restoration/print shop). Our production site is purely php, and completely separate from ZC, but it IS a sub-domain of the main site, and set up in the same directory as ZC. All of which was built before I came on.

3 Jan 2018, 5:28 PM
#7
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

The other big one I have is

[29-Dec-2017 17:25:32 America/New_York] PHP Notice: Undefined offset: ### in /home/********/public_html/includes/classes/categories_ul_generator.php on line 63

[29-Dec-2017 17:25:32 America/New_York] PHP Notice: Undefined offset: ### in /home/********/public_html/includes/classes/categories_ul_generator.php on line 72

I have this error repeating over and over, with "###" being any number from 2 to 166.

if (($this->data[$parent_id])) {            foreach($this->data[$parent_id] as $category_id => $category) {                $category_link = $parent_link . $category_id;                if (($this->data[$category_id])) {                    $result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');                } else {                    $result .= sprintf($this->child_start_string, '');                }                $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';                $result .= $category['name'];                $result .= '</a>';                                  if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {                    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');                }                $result .= $this->child_end_string;            }        }                $result .= $this->parent_group_end_string;        return $result;    }
3 Jan 2018, 5:29 PM
#8
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

The other big one I have is

[29-Dec-2017 17:25:32 America/New_York] PHP Notice: Undefined offset: ### in /home/********/public_html/includes/classes/categories_ul_generator.php on line 63

[29-Dec-2017 17:25:32 America/New_York] PHP Notice: Undefined offset: ### in /home/********/public_html/includes/classes/categories_ul_generator.php on line 72

I have this error repeating over and over, with "###" being any number from 2 to 166.

if (($this->data[$parent_id])) {            foreach($this->data[$parent_id] as $category_id => $category) {                $category_link = $parent_link . $category_id;                if (($this->data[$category_id])) {                    $result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');                } else {                    $result .= sprintf($this->child_start_string, '');                }                $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';                $result .= $category['name'];                $result .= '</a>';                                  if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {                    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');                }                $result .= $this->child_end_string;            }        }                $result .= $this->parent_group_end_string;        return $result;    }
3 Jan 2018, 9:26 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Excessive PHP warnings

Lordzoabar:

The cache exists, but for some reason, everything gets sent to logs instead.
He was asking about the cache directory because of your error message which said your store is trying to write to a specific file in that directory:

"/html/cache/page_parse_time.log : failed to open stream: No such file or directory"

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Jan 2018, 9:50 PM
#10
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

DrByte:

He was asking about the cache directory because of your error message which said your store is trying to write to a specific file in that directory:

"/html/cache/page_parse_time.log : failed to open stream: No such file or directory"

Rereading it again, that does make more sense. And no, said file does not exist. I just turned off page-parse times like you suggested, though. As for the permissions, they are set at 755, as well.

4 Jan 2018, 4:16 PM
#11
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Re: Excessive PHP warnings

As lat9 already mentioned, for some reason your DIR_FS_ADMIN definition is missing. I'm not sure if that's causing the other errors, or if you really do have the Product Sorter files in the wrong directories. It seems the files were uploaded to the frontend instead of the admin directory so it's failing.
From what I know, the Product Sorter plugin has never caused such problems, especially not on a 1.5.5 store using php 5.6 so I'll have to point my finger at a faulty installation of the plugin.

As for the page_parse_time.log - this seems to be a file outside of Zen Cart's file structure so my guess is you have bad lines in your configure.php file, probably leftovers from an old(er) server. Notice how you have completely different paths:
/home//public_html/
vs.
/home/webadmin/
/html/cache/page_parse_time.log

My site - Pro ZC Help
My portfolio | My plugins

4 Jan 2018, 4:59 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Excessive PHP warnings

balihr, if you look into Admin->Configuration->Logging, you'll see there's an option to specify a file into which page-parse-time stats can be logged. That file must exist in a location that allows the file to be writeable. Turning the feature off will disable the errors.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Jan 2018, 5:02 PM
#13
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

The thing is, when I had it installed, the product sorter WORKS. It does everything it's supposed to do, and, visually at least, it never gave me any problems. It's only in the log files where anything about it even shows up, and it's one of the more prominent and repetitive errors I get.

Ultimately, we want to do a complete site overhaul/redesign, but at the moment there's just a lot of bloat and unused/obsolete files in our server, that we're trying to clean up. Our store has been live for so long, and without being properly maintained that we have files that point to files that no longer exist.

4 Jan 2018, 9:23 PM
#14
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Re: Excessive PHP warnings

DrByte:

balihr, if you look into Admin->Configuration->Logging, you'll see there's an option to specify a file into which page-parse-time stats can be logged. That file must exist in a location that allows the file to be writeable. Turning the feature off will disable the errors.

I stand corrected - it's not coming from the configure files. And yes, of course, turning it off will disable those specific errors, I wasn't questioning that. :smile:

Lordzoabar:

The thing is, when I had it installed, the product sorter WORKS. It does everything it's supposed to do, and, visually at least, it never gave me any problems. It's only in the log files where anything about it even shows up, and it's one of the more prominent and repetitive errors I get.

Ultimately, we want to do a complete site overhaul/redesign, but at the moment there's just a lot of bloat and unused/obsolete files in our server, that we're trying to clean up. Our store has been live for so long, and without being properly maintained that we have files that point to files that no longer exist.
If you want to keep using it, I'd suggest simply downloading the files and then go over your store's files (store_root/includes) and see if you find any files from the downloaded package there (includes/init_includes/init_zx_product_sorter.php) and if you do, just delete those files. There's not one single file in Product Sorter that's supposed to be uploaded to store_root/includes - it all goes to the admin directory. I believe/hope this would solve your problems and you'd be able to continue using it.
But, we're getting OT here so I'll let myself out, and hopefully someone else helps you figure out why the categories_ul_generator.php is creating those warnings.

My site - Pro ZC Help
My portfolio | My plugins

4 Jan 2018, 10:03 PM
#15
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

Ok... over the past few hours, I've completely cleared my error logs cache out, and went and generated a fresh log for each of the main pages I'm having issues with. The attachment uploader won't let me do the 2 big ones I have, and I'm not about to just copy/paste them into the text box here, since they're both close to 50-60 pages in length, but these are some of the smaller ones.

Attachment #17592

Attachment #17593

Attachment #17594

Attachment #17595

5 Jan 2018, 12:06 AM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Excessive PHP warnings

Just a little "aside". Besides that I'm on a mobile device which requires me to download the above associated file(s) in order to read/see what the long list of issues might be, please understand that we don't need to see the entire error list of content in order to address the issue. Typically the error is provided in the first two "paragraphs". The first typically gives a breakdown of the file stack (path of files accessed to cause the issue) and then the second "paragraph" identifies the actual issue and where it is located. So we don't need to have the entire list.

Besides that, the first issue will likely cause other issues to be caused and those will be listed as well, but wouldn't exist if the initial issue had been addressed/prevented.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

5 Jan 2018, 12:18 AM
#17
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

Ok, I understand that. And the issues with being on a phone. I don’t know if there is something wrong with how our logging system is set up, but everything I get comes in as just one solid block of text. I can tell from the time-stamp where one error ends and the next begins, but they way they get listed, there isn’t any space between the line number of the prior, and the open bracket of the following time-stamp. I’ve gone in and physically separated each and every line, just so it can be read.

5 Jan 2018, 1:48 AM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Excessive PHP warnings

So, to add to this. Some of the more recent messages that have been posted about appear to be related either to using a php version that is now complaining about things that weren't an issue in the past or that a plugin has been installed and is active that oh I don't know reports all errors. :P (tongue-in-cheek method to provide the name of a plugin that causes the loss of error separation like you describe). Basically in the applicable enable logging file, there is a trim that is added around part of the message to log. This trim causes the loss of the "space" between the two parts of the message response. It can save some data storage space and if using some sort of other "message" reader it can be filtered out by the initial "time stamp" format. But it does make it more difficult to read in a jiffy.

Anyways, part of that is to say while such notices and warnings are best not to occur (as recently explained to me they slow down system operation because they have to be dealt with in some way), but if the site is operational then they aren't horrible to have... Further if the site is operational even when such a message is generated, the message isn't an error... an error stops operation. Causes a white screen, etc...

As for the "mobile" comment, well, actually a couple of things. Not sure I want to download a zip file or what may look like a pdf file that could potentially contain any type of content. Can possibly call it lazy, but I think of it more as one less thing to have to worry about. Code, content posted in the forum. Far less likely an issue. Download something just to help and it possibly have something undesirable intertwined (afterall computer is having an issue right?), not so likely.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

5 Jan 2018, 4:18 PM
#19
lordzoabar avatar

lordzoabar

New Zenner

Join Date:
Nov 2017
Location:
Athens, Georgia, USA
Posts:
104
Plugin Contributions:
0

Re: Excessive PHP warnings

Ok, fair enough. I got this position in the company, because out of everyone here, I'm the most technically inclined. That said, I am still very much a noob when it comes to PHP (and programming languages in general). I know just enough to be dangerous on my own, and, if told whats causing what, to be able to track it down and somewhat figure it out, and everything I DO know has more or less been through trial and error. If you're saying that there isn't anything to actually worry about, then I'll take that as it is. We WOULD like to get the site running at a higher level of PHP, if only for optimization purposes, but if it's working for the moment, then that's good enough.

5 Jan 2018, 5:25 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Excessive PHP warnings

While some of the warnings and notices will be fixed with a Zen Cart upgrade, several of them come from plugins which may or may not have been updated adequately to not trigger "undefined variable" or "undefined constant" or "already defined constant" or "undefined index" warnings.

As of today, the latest Zen Cart version is v1.5.5f which is compatible to as high as PHP 7.1 (it will trigger lots more "undefined constant" warnings in PHP 7.2; those are being addressed in ZC 1.5.6 which will be compatible with PHP 7.2).

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.