Zen Cart Logo
Forums / General Questions / How to turn off PHP errors so that no one can see you file structure

How to turn off PHP errors so that no one can see you file structure

Locked

Views: 3,739

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
1 Apr 2007, 2:29 PM
#1
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

How to turn off PHP errors so that no one can see you file structure

Dear All,

I was wondering if any knows how to stop ZenCart from displaying the errors out onto the browser like the following:

Warning: Division by zero in /home/server/user/www.mywebsite.co.uk/shop/includes/modules/category_row.php on line 245

I know there is a way of doing it using PHP, but how would I implement it into Zencart and which file would I put it in?

Regards
Solidariti

1 Apr 2007, 2:33 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to turn off PHP errors so that no one can see you file structure

I'd first worry about why you have division by zero errors before trying to hide the error ...

What is your setting in the Maximum Values for:

Categories To List Per Row
How many categories to list per row

Then be concerned that there are only 50 lines in the file
/includes/modules/category_row.php

you list line 245 ... :eek:

1 Apr 2007, 2:53 PM
#3
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

Dear Linda,

Thank you I changed the amount of line numbers, just for security reasons the line it is on is 24. The maximum number for the list of categories on a row is 3, and there seems to be 3 categories being displayed.

Regards
Solidariti

1 Apr 2007, 3:07 PM
#4
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

Do you know hw I would go about fixing this issue, and then stopping zencart from displaying errors?

Regards
Solidariti

1 Apr 2007, 3:09 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to turn off PHP errors so that no one can see you file structure

What version Zen Cart ...

What code do you have lines 20 to 30?

1 Apr 2007, 3:27 PM
#6
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

1.3.0.1 it says its current

$row = 0;
$col = 0;
$list_box_contents = '';
if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
$col_width = floor(100/$num_categories);
} else {
$col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
}

while (!$categories->EOF) {
if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';

1 Apr 2007, 3:35 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to turn off PHP errors so that no one can see you file structure

Zen Cart v1.3.0.1 has so many security issues and bugs and lack of features ...

Have you considered upgrading to the current Zen Cart v1.3.7 with the Patch for:
http://www.zen-cart.com/forum/showthread.php?t=56216

1 Apr 2007, 3:37 PM
#8
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

How come it says that it is still current? Is that a beta version then?

1 Apr 2007, 3:38 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to turn off PHP errors so that no one can see you file structure

That was one of the bugs in that version ... :eek:

2 Apr 2007, 3:03 PM
#10
solidariti avatar

solidariti

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

What are the procedures before an update should be conducted?

8 Apr 2007, 5:22 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to turn off PHP errors so that no one can see you file structure

Backup both your database and your shop code from the site ...

Make a new database table and load the copy of your Live site database into it ... let's assume this is a database called: zen_v137

Let's say your Live shop is in:
/catalog

Make a new directory:
/new_shop

Copy all files from /catalog to /new_shop

Next, edit the 2 configuration files:
/new_shop/includes/configure.php
/new_shop/admin/includes/configure.php

Change all of the paths to reflect the new path:
/new_shop where you see /catalog

Change the database references to the new database table zen_v137 and username and password ...

Next, load all of the files from a clean download of Zen Cart v1.3.7 from our site to the:
/new_shop

If you have used the templates and overrides everywhere correctly ... you will not overwrite any of your changes ...

However ... now you need to compare your custom code to the new files to see what changes there might be in the code or language files where there might be new language defines etc.

I use Beyond Compare from scootersoftware.com

First I compare a clean v1.3.7 to a clean old version of the Zen Cart you currently are running to see specific differences ...

Then, I compare the clean v1.3.7 to the template and override directories to see what I need to change or update ...

By using the new directory and database you can take your time on an upgrade ...

To upgrade the database you would run the:
/new_shop/zc_install

And Upgrade the database ...

NOTE: you will do this upgrade of the database a few times ...

The reason you will do this a few times is right now you are testing and tweaking a new database with the new code so that you can adjust the code that is in the:
/new_shop

until all is working right ...

When you think all is right ... you want to empty the tables in the new database zen_v137 and again backup your Live shop database and load it into the zen_v137 database and upgrade again ...

Test the shop again ...

NOTE: if making database changes you should keep a NotePad open to jot down what changes you make to remind you to make them each time you run this proceedure ...

Then test test test ... does everything work right? Does everything look right? Do orders work? Do emails work? etc. etc. etc.

When you think you have this all functional and down to a science on the upgrade of the database ...

Set the Live site to Down for Maintenance ...

Empty the database for the new site zen_v137 ... again

Backup the Live site database ...

Load into the new site database into zen_v137 ...

Run the /new_shop/zc_install again and Upgrade the database ...

Test everything one more time ...

Make sure these tests included:
create account
login/logout
checkout
test each payment module
check the admin for the new customers, orders, etc.

If all is right ... and perfect ...

Edit the two configuration files in the New Shop:
/new_shop/includes/configure.php
/new_shop/admin/includes/configure.php

Change the paths from:
/new_shop to /catalog

Do NOT change the database name, username or password ... this new database zen_v137 is your new database from now on ... save your old database in case of problems ...

Rename the directory for the Live site from:
/catalog to /old_site

rename the directory for the New site from:
/new_shop to /catalog

Set the new Live site off of Down for Maintenance ... and your site is back up and running ...

Read this through several times to get the hang of what you are really doing here ...

Practice the upgrade several times and really test everything ...

Only when you really think you are ready to do the last stage of the Down for Maintenance on the Live site ... backup of the Live Site database for the last time ... and the last empty and load of the Live site database to the new database and the last /new_shop/zc_install are you in any rush so to speak ... and even then ... take your time ...

You can do this over a day or a week or a month to get a site ready to go live on an upgrade using this method ...

NOTE: if you do not use a directory such as:
/catalog

but use the root of your site ...

You can move the files and directories into a directory called:
/old_site

And move the files and directories from /new_shop to your root ...

NOTE: usually when you do this method to the root you do not move your /images directory ...

8 Apr 2007, 11:12 AM
#12
skilaq avatar

skilaq

New Zenner

Join Date:
Mar 2007
Posts:
46
Plugin Contributions:
0

Re: How to turn off PHP errors so that no one can see you file structure

Warning: Cannot modify header information - headers already sent by (output started at /home/XXX/public_html/test/includes/languages/english/index.php:117) in /home/XXX/public_html/test/includes/functions/functions_general.php on line 44

what does this error mean, just randomly came up after trying to get rid of the congratulations banner at top on home page.

PLEASE HELP!

8 Apr 2007, 2:36 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: How to turn off PHP errors so that no one can see you file structure

skilaq:

Warning: Cannot modify header information - headers already sent by (output started at /home/XXX/public_html/test**/includes/languages/english/index.php:117**) in /home/XXX/public_html/test/includes/functions/functions_general.php on line 44

what does this error mean, just randomly came up after trying to get rid of the congratulations banner at top on home page.

PLEASE HELP!

This FAQ discusses this error message:
https://www.zen-cart.com/tutorials/index.php?article=87