Reins report php p. Trekking reference

The article describes the functionality that is available in PHP (relevant for 5.3.x) for handling errors of all types, including code interpretation errors (E_ERROR, E_PARSE, E_WARNING, etc). This processing will help you to display the page in a controlled manner in the event of such problems. The article contains many descriptions and working examples (architectures) in order to immediately use it in your software product. In the end, well, the site was broken a little, well, you need to inform the search engine about this with a title 4xx or 5xx and amuse the user, instead of returning a white screen (or worse, a screen with sacred information, for hackers) with a 200 Ok answer.

The idea to write this topic arose when I bravely asked 2 questions:

  • The question of intercepting warnings and outputting errors to a specified location in the template
  • The question of catching critical errors that make the script only stop execution
According to my karma and adding to favorites, I realized that they turned out to be interesting for the PHP habrasocommunity. For this reason, I decided to formulate solutions to these issues in the form of an article, so that it would be easier and more complex for people and search engines to find the information they need.

If you are interested, then the details are under the cut ...

Reasons to use

The user / search engine needs to clearly answer that there is a problem on the server. Without the use of a certain feng shui, this is quite difficult to achieve, and sometimes impossible. Here I shed light on all this, well, I leave a note for myself, because a week ago I did not know what to take on, and, probably, many newcomers will also be discouraged.

Function descriptions

This functionality is available in PHP in order to handle errors and control the output. Here is a description of their goodies and weaknesses. I will not give the documentation, I will only refer to its pages and describe my opinion. All that will be given is only a small fraction, I will provide links to the relevant sections of the documentation at the end of the article. So we meet:

- Control of non-critical errors: remarks, warnings, user errors. In general, everything that does not terminate the interpretation abnormally.
set_error_handler - Sets a user-defined error handler.
It is needed in order to write all such errors to the log. If you do not ask it, then it is not written to the log, but I always want to know under what combat situations comments and warnings can be triggered. That is, it allows the user to automatically test the product and he will not even notice it.
If the function is not set, then PHP only tries to display the data on the screen, and if it is not given it, then in general there are no signs of life from these types of errors.

- Control, exceptions: is an error of type E_ERROR.
set_exception_handler - Sets a custom exception handler
Well, I don't know why it was invented at all, when there is what is described below and just handling an error of the Exception type. So I'm reporting that it just exists. It catches the critical exception "exception" and lets you do something about it. In any case, the script ends. Her default work is enough for me personally (writes to logs, tries to display). I would not override it at all, otherwise I will have to write to the logs about the happened exception myself.

- Output control functions: Here I will describe 3 functions that you should know for different reasons. For example, for performance issues or for header output issues. In our case, we need to display error headers.

Conditions
There is a file with a code that is launched first or before the code in which an error may appear, and this file and all files before it are 100% debugged with the impossibility of an error. Here is such a condition to make it easier - without errors until all registrations of the above functions are completed. This file describes these error control methods in the complex. The buffer is monitored, if there is an error, then flush the buffer and display the error.
Code with comments
On my own I will add that I have not tested the code, since this is a simplified diagram of what I have in the code, comments are accepted


Report on the campaign Ergaki-2003

MOU DO Tourist and local history club "Ermak"

Mountain hike report 1 class in the area of ​​the Ergaki ridge (Western Sayan),
completed from 20.06.2003 to 03.07.2003.

Tour leader: Shishkin S.V.

MCC of the Republic of Khakassia MU "Center for Children and Youth Tourism"



The original report is available at http://tkk-ermak.by.ru/ergaki20030.htm

Trekking reference

1. Conducting organization:
Municipal educational institution of additional education Tourist and local history club "Ermak" of the administration of the Ermakovsky district.

3. Location of the hike
Krasnoyarsk region, Ermakovsky district, Ergaki ridge.

4. Thread of the route:
Route M-54 (Krasnoyarsk - State border, Tormozakovsky bridge, 614 km) - r. Malaya Buiba - Lake Raduzhnoe - (happy exit of Lake Raduzhnoe - a waterfall in the north-west of Raduzhnoe, Raduzhnoe - Hanging Stone) - lane. Intermediate (Legs) (n / a) - lane. Khudozhnikov-2 (1A) - Dream camp - (happy exit. Dream - Mountain Spirits vp. - Mountain Spirits lake - Tolstoy Brother peak (1A) - Taigish-1 lane (1A) - Lazurnoe lake - Pomoshchnyi lane ( n / a) - parking Skazka - (rad.exit to the station Skazka - lane Auxiliary (n / k) - Kamenny Zamok) - (rad.exit to the station Skazka - Mount Perevalnaya (1A) - the pass dividing the valleys of the Glubokoe lakes and Severnoe (n / k) - Lake Severnoye - Vp. Bogatyr - Vp.Gracia - Lane Rescuers (1A) - Lane NKT (1A) - Lake Chernoe - River Taigishonok - River Lev Taigish - Strelka - Kresty - Pryamoy Taigish river - Bolshoye Buibinskoe lake - Bezrybnoe lake - Zeleny lane (1A) - Zolotarnoe lake - Vidovka lake - Svetloye lake - Medvezhye lake - Medvezhy river - Tushkanchik river - M-54 highway (Krasnoyarsk - State border, 622 km.)

5. Determining obstacles of the route:
Total obstacles: 11
Passes - 8 (Intermediate (Legs) (n / a), Artists-2 (1A), Taigish-1 (1A), Auxiliary (n / a), Rescuers (1A), NKT (1A), Green (1A), Marble (1A) ))
Vertices: - 3 (Tolstoy Brother peak (n / a), Perevalnaya mountain (1A), shoulder of Ptitsa peak (1A))

6. Information about the participants:

p / p FULL NAME. Year of birth Place of work, study Address, telephone Travel experience Duty to hike
1 Shishkin Sergey Vasilievich 1971 TKK "Ermak, PDO with. Ermakovskoe, st. K. Marx, 129-2 t. 2-44-09 1 x leader Supervisor
2 Blinov Yury Evgenievich 1966 TKK "Ermak", PDO Oyskiy, t. 31-3-56 1 x leader Deputy hands.
3 Lykhin Evgeny Anatolievich 1971 PU - 75, Kazantsevo village with. Kazantsevo, t. 2-88-70 1 x leader Navigator
4 Kostenko Oleg Anatolievich 1987 Student ESH 1 with. Ermakovskoe st. Red Partisans, 63 n / a pom. caretaker
5 Filatov Ruslan Valerievich 1987 Pupil ESH ¦1 with. Ermakovskoe st. Youth, 2-B n / a Timekeeper
6 Dmitry Sergeevich Tselukovsky 1987 Pupil ESH ¦1 with. Ermakovskoe n / a No
7 Kuzmin, Andrey Sergeevich 1987 Pupil ESH ¦1 with. Ermakovskoe st. Youth, 19 n / a Photographer
8 Verfel Yana Evgenievna 1987 Pupil ESH ¦1 with. Ermakovskoe, st. Lepeshinskikh, 2-1 Party 1 cop Manager
9 Lanshakova Oksana Andreevna 1987 Pupil ESH ¦1 with. Ermakovskoe st. Lenin, 81-4 n / a Chronicler
10 Mishina Yulia Nikolaevna 1987 Pupil ESH ¦1 village Ermakovskoe, st. Krupskaya, 12-1 n / a Medic
11 Khanzhina Maria Alexandrovna 1987 Pupil of the Oysk secondary school n / a No
12 Goncharov Ivan Sergeevich 1987 Pupil of the Oysk secondary school Oysk settlement, Ermakovsky district n / a No
13 Popov Denis Alekseevich 1987 Pupil of the Oysk secondary school Oysk settlement, Ermakovsky district n / a No
14 Anokhina Lyudmila Viktorovna 1984 with. Kuragino. pvd No
15 Mahold Svetlana Viktorovna 1984 Student of Kazantsevsky PU-75 with. Kuragino. pvd No
16 Makhold Oksana Viktorovna 1985 Student of Kazantsevsky PU-75 with. Kuragino. pvd No
17 Nesterova Lyudmila Viktorovna 1984 Student of Kazantsevsky PU-75 with. Kuragino. pvd No

7.
A copy of the report, photographic materials, a video film about the trip are stored at:
662820, Krasnoyarsk Territory, Ermakovsky District, s. Ermakovskoe, st. K. Marx, 129-2.
Shishkin Sergey Vasilievich.
Tel. (391-38) 2-44-09
Email: [email protected]

Travel area information

The travel area is described in detail on the sites:

www.ergaki.krasu.ru - this site also has two types district maps, by which you can track the thread of our route.

Arrival and departure options

The Ergaki ridge is located quite close to the M-54 highway (Krasnoyarsk-Kyzyl-Gos. Border). The most frequently used entry and exit options are the Tormozakovsky bridge and the bridge over the Tushkanchik river. In the first case, the trail from the Tormozakovsky bridge leads to the lake. Raduzhnoe, in the second - on the lake. Light (or Bear Stream). The same trails are used for emergency exit with routes as the shortest and easiest. Three Kyzyl-Abakan buses pass along the road every day, and the Ermakovskoe-Usinsk bus twice a week. In the summer they often go route taxis to (from) the railway station of Abakan. Distance to nearest settlements- to Aradan - 40 km, to Tanzibey - 70 km. On the Tormozakovsky bridge and at the mouth of the river. The jerboa has tourist houses (paid), parking lots, baths. There is a telephone with intercity communication on the Tormozakovsky bridge, in the house of TKK "Ermak" on Tushkanchik there is a walkie-talkie with direct communication with the Ministry of Emergency Situations.

Route changes and their reasons.

The route of the hike was completed in full. Two planned days were used "as intended" - during a prolonged rain.

Group movement schedule

Days of the way date Section of the path Length (km) Running time (hour-min) Defining obstacles Meteorological conditions
1 20.06.03 Tormozakovsky bridge (614 km of the M-54 highway) - Lake Rainbow 6 2-45 No Rain, fog, cold
2 21.06.03 Radial exits to waterfall and Hanging Stone 2 2-37 No Cloudy, no rain
3 22.06.03 Oz. Raduzhnoe - Dream parking 7 7-23 per. intermediate (n / a), per. Artists-2 (1A) Sunny, hot
4 23.06.03 Radial hike - Mountain Spirits waterfall - Mountain Spirits lake - Tolstoy Brother peak 2 4-40 Peak Fat Brother (1A) First half of the day - sunny, second - windy, cloudy, then rain
5 24.06.03 Day due to bad weather - - No Lingering rain, cold, windy
6 25.06.03 Camp Dream - Lake Lazurnoe 4 5-10 per. Taigish-1 (1A) In the morning - rain, then - cloudy, windy, no rain, in the evening - sunny
7 26.06.03 Lake Lazurnoye - Skazka parking lot 8 3-44 per. Auxiliary (n / a) Sunny, warm, late at night - strong hail with wind
8 27.06.03 Radial exit to the Stone Castle 3 3-03 per. Auxiliary (n / a) at the beginning of the day it rains, then sunny, then cloudy, with a rare rain.
9 28.06.03 Radial hike to the Bogatyr and Grazia waterfalls 15 9-13 Perevalnaya mountain (1A), Rescuer pass (1A) windy, cloudy, warm, no rain
10 29.06.03 Parking Fairy Tale - Arrow 8 4-23 pass NKT (1A) sunny
11 30.06.03 Arrow - Lake Bezrybnoe 25 7-35 No sunny, hot
12 1.07.03 Lake Bezrybnoe - Bear Creek 15 5-55 pass Zeleny (1A) sunny, hot
13 2.07.03 Day due to bad weather - - No Rain, thunderstorm
14 3.07.03 Bear Stream - r. Jerboa - highway M-54 (622 km). 8 2-31 No overcast, occasional rain, sunny in the afternoon

additional information

Our group acted as a "tourist patrol", whose task was to clean up parking lots and trails from household waste along the path of the group, explain to everyone who would meet us on the way, the basics of correct "ecological" behavior in nature, marking the main routes ... Therefore, along with the main activity of passing the route, we cleaned and sawed paths, removed garbage, equipped tourist camps (arranged stationary fireplaces, installed tables, sheds, dug garbage pits, etc.).

Tourist patrol motto:

Animals and cattle can only be cleaned by people!

Travel diary.

Instead of a prologue.

Here the passes smell like socks -
(our, folk)

We decided to write this diary in a more or less "free" style. We hope that all the technical information required for coverage in the diary will not fall into the shadow of some "lyrical-libertine" digressions. Highlighted text- these are inserts from the diary of our chronicler Lanshakova Oksana. I (S.V. - Sergei Shishkin) wrote the NOT SELECTED text based on my recollections and recollections, inspired by reading the chronicler's diary and watching a video film about our campaign. Moreover, these two authors hereinafter will interrupt each other and even duplicate each other, describing the same events in different ways.

P.S.
And the numbers on the cans have a slightly different meaning.

Gallery of some of the characters

Instructors

Other blacks and mestizos

Mouse
(Mishina Julia)

Oksa
(Lanshakova Oksana)
Yanka-caretaker
(Jan's Werfel)
Dronych
(Kuzmin Andrey)
Rusya
(Filatov Ruslan)

Dimych
(Dmitry Tselukovsky)

Oleg
(Kostenko Oleg)
Masha
(Khanzhina Maria)
Lyuska-1
(Anokhina Lyudmila)
Lyuska-2
(Nesterova Lyudmila)

1 day

20062003 - number on a tin can.
Arrival (or departure)

"This is where the Snark is found!" - exclaimed Balabon.
Pointing to the top of the mountain;
And he pulled the sailors to the shore,
They were pulled up by the whirlwinds
.
(Lewis Carroll, "The Snark Hunt")

July 20, 2003 a group of tourists, consisting of 3 instructors S.V.(Sergei Vasilievich), uncle Zhenya(Evgeny Anatolyevich), uncle Yura(Yuri Evgenievich) and just beginning mountaineers:

Svetlana and Oksana Makhold- namesakes from the village. Kazantsevo
Lyuda and Lyuda (Lyuska)- namesakes (also from there)
Ivan and Dan- inveterate gamblers and just nice people from the village of Oisky
Masha- Little Red Riding Hood (from the same place)
Manager- Yanka (Verfel, Ermakovskoe village)
Repairman - Drone (Dronych)(Andrey Kuzmin, village Ermakovskoe)
Oleg and Dimych- inseparable friends (Kostenko and Tselukovsky, village Ermakovskoe)
Timekeeper (Rus)- Ruslan Filatov (Ermakovskoe village)
Medic - Mouse(Mishina Yulia, village Ermakovskoe)
and a humble but observant chronicler - Oksana L.(Lanshakova, village Ermakovskoe)

left the wonderful village of Ermakovskoye in Ergaki. Everyone had a backpack (a back bag with a bunch of pockets, two straps, self-dumping on the belt, if desired - with a frame), equipment (harness (top and bottom), two carabiners, an eight and a rope), tents - one Royal - instructor's, two Mana-2 tents from Rock Pillars (you can buy the goods of this company at the address: Krasnoyarsk, Lenina st., 76), two Dragon-5 tents from the St. The Green Tie is a hallmark of the Tourist Patrol (also for everyone).
So now these 14 naive and 3 hardened lovers of an active lifestyle are shaking on the bus and still do not know what lies ahead of them.


A bus from Ermakovsky brought our group to the Tormozakovsky bridge (614 km of the Krasnoyarsk - State border highway) at 12-00.

We landed near the Tormozakovsky bridge (the place where many tourist routes start), warmed up, despite the rain right next to the track, had a snack, drove the first one during this trip and moved to our first parking lot on Lake Raduzhnoe.
After a short snack right by the road, at 12-20 we set off.

We went there for a reason, but with a lofty mission to show the true path to travelers who do not know the way to the lake. I hope no one gets lost, although only the most careless (most goof) tourist will not reach the lake according to our markings, made from old red S.V. sweatpants, cut into ribbons. The whole road to the lake was pleasant, except for the ongoing rain, constant dampness and fog, the path, broken into mud, with which we had already smeared ourselves up to the carbines (or even higher).

Setting up a robots.txt file

robots.txt- a special file intended for search engines. It specifies the indexing parameters for a specific site. If you want your forum to be indexed correctly, then you should not overlook the presence of this file. I'll try to describe the procedure for creating robots.txt specialized for phpBB forums.

Prohibiting indexing

First, you need to prohibit the indexing of all service pages that do not contain unique content and only reduce the relevance of the forum. Indexing is disabled using the directive Disallow: with an argument in the form of a page (or template of pages) that do not need to be indexed. Service pages in phpBB are for example ucp.php (Personal section), faq.php (FAQ), search.php (Search), memberlist.php (Members)... The code we need:

User-agent: *
Disallow: /faq.php
Disallow: /mcp.php
Disallow: /memberlist.php
Disallow: /posting.php
Disallow: /report.php
Disallow: /search.php
Disallow: /style.php
Disallow: /ucp.php

Also for phpBB it is worth prohibiting the indexing of links to specific messages. They look like this - viewtopic.php? P = 54 # p54. To do this, we just need to specify only one line in robots.txt, using * (asterisk) to indicate the template:

Disallow: /viewtopic.php?p=*

You can also prohibit indexing of the first pages of topics, since a link to a topic without specifying a page parameter leads exactly to it, therefore it makes no sense to additionally specify the first page as a parameter - you get the same content for different links. Links to the first pages are of the form viewtopic.php? f = 69 & t = 724145 & start = 0... Therefore, to prohibit indexing, you need to use the following code:

Disallow: /viewtopic.php?f=*&t=*&start=0$

When viewing each topic, 2 links are displayed below, leading to neighboring topics - the previous and the next in the list. For such links the parameter is used view correspondingly having the values view = next and view = previous... It is also better to prohibit such links for indexing:

Disallow: /viewtopic.php?f=*&t=*&view=next

Specifying the sitemap file

To speed up indexing of new pages and re-indexing old ones, sitemaps are very helpful. Inline sitemap in phpBB3 by this moment no, but you can put one of the existing sitemap generator mods for the forum (for example, Sitemap FX written by me). If you do not have a sitemap and do not plan to install one, then you can skip this point. The rest need to write the directive Sitemap: with the path to the sitemap file as an argument:

Sitemap: /sitemap.php

You can specify several sitemaps at once if you have them generated in several files:

Sitemap: /forum/sitemap/01.xml
Sitemap: /forum/sitemap/02.xml

Specifying the intervals between robot hits

Sometimes it happens that the robot, when indexing your forum, creates too much load on the server, which can lead to bad consequences, for example, a temporary server shutdown. To remedy this situation, the directive was introduced Crawl-delay that sets timeouts when robots access the site. The argument of this directive is the time in seconds, more often than which the robot should not access the site (less often, it can). If we want to specify a timeout, for example, 5 seconds, then we need to put the following code in our robots.txt:

Specifying dynamic parameters from url

PhpBB has been using sessions for a long time, which are appended to links on the forum as a parameter sid =... If the cookies are configured correctly on the forum, this parameter will be in the address only once, then it will be written to the cookies. In addition, for all search engines registered on the forum in the group "Bots", sessions are disabled automatically. However, you can play it safe by registering the session ID as a dynamic parameter in the robots.txt file - and then robots will not take it into account when indexing pages. For this, the directive is used Clean-param, about which I already wrote. She has two arguments. The first argument is the actual dynamic parameter in the url itself. The second argument is the prefix of the path of the pages on which this parameter can be used. Therefore, we get the following code for robots.txt:

Clean-param: sid /index.php

Specifying the primary host

For Yandex, you can also specify the main site host. The fact is that each site can be accessed at several addresses, as an example - phpbbguru.net/ and phpbbhacks.ru/ lead to the same site. However, only one address will be taken into account in the search engine, which will be displayed in the search results. Directive Host: with an argument in the form of a site address, you can specify the recommended address for the search engine (since, according to Yandex, this directive is not a decisive factor in determining the main host of the site, but it is of great importance).

And despite the fact that almost all forums are available only at one address, I recommend not to ignore this directive for at least two reasons. First, from the Yandex point of view, the addresses of the forum with www. and without it are different hosts. Therefore, if you promote your forum with an address without www, and in Yandex it is indexed with www., Then there will be little good. Secondly, some dishonest people can sometimes merge your forum and their domain. They buy a domain and host a complete copy of your forum on it. The search engine sees two identical forums with different addresses, and takes them for mirrors of the same forum. In this case, the possibility of defining the attacker's address as the main host is great, and then all visitors from Yandex will go not to your forum, but to a copy of it.

Let our forum be available at www.lastforum.ru and lastforum.ru. We need to define an address without www as the main host (I personally recommend doing this, because I think the www prefix is ​​just a rudiment left over from ancient times). To do this, we need to write the directive Host specially for Yandex. An important point- directive Host must be mentioned after the directive Disallow: so you need a code like this:

User-agent: Yandex
Disallow: /faq.php
Host: lastforum.ru

It is best to place this code at the end of your robots.txt file.

The final version of robots.txt for phpBB

Considering all of the above, you can compose a complete version of the robots.txt file for the phpBB 3 forum. As an example, I will take the already mentioned lastforum.ru:

User-agent: *
Disallow: /faq.php
Disallow: /mcp.php
Disallow: /memberlist.php
Disallow: /posting.php
Disallow: /report.php
Disallow: /search.php
Disallow: /style.php
Disallow: /ucp.php
Disallow: /viewtopic.php?p=*

Disallow: /viewtopic.php?f=*&t=*&view=previous
Sitemap: /sitemap.php
Clean-param: sid /index.php
Clean-param: sid /viewforum.php
Clean-param: sid /viewtopic.php

User-agent: Yandex
Disallow: /faq.php
Disallow: /mcp.php
Disallow: /memberlist.php
Disallow: /posting.php
Disallow: /report.php
Disallow: /search.php
Disallow: /style.php
Disallow: /ucp.php
Disallow: /viewtopic.php?p=*
Disallow: /viewtopic.php?f=*&t=*&start=0$
Disallow: /viewtopic.php?f=*&t=*&view=next
Disallow: /viewtopic.php?f=*&t=*&view=previous
Host: lastforum.ru
Sitemap: /sitemap.php
Clean-param: sid /index.php
Clean-param: sid /viewforum.php
Clean-param: sid /viewtopic.php

Robots.txt file location

The robots.txt file should only be in the root of the site / forum. Considering that forums can be located in three ways - separately, on a subdomain and in a directory, you need to place robots.txt accordingly. In the case of a separate forum, as well as a forum on a subdomain, the robots.txt file must be located in the root of the forum (in the same folder where the file config.php). If the forum is located in a subdirectory of the site, then robots.txt must be located at the root of the site, and all arguments inside robots.txt must be written in accordance with the path to them from the root. That is, if the forum is located in the forum / (example.com/forum/) folder, then the previous robots.txt example will look like this:

User-agent: * Disallow: /forum/faq.php
Disallow: /forum/mcp.php

Disallow: /forum/posting.php
Disallow: /forum/report.php
Disallow: /forum/search.php
Disallow: /forum/style.php
Disallow: /forum/ucp.php




Sitemap: /forum/sitemap.php


User-agent: Yandex
Disallow: /forum/faq.php
Disallow: /forum/mcp.php
Disallow: /forum/memberlist.php
Disallow: /forum/posting.php
Disallow: /forum/report.php
Disallow: /forum/search.php
Disallow: /forum/style.php
Disallow: /forum/ucp.php
Disallow: /forum/viewtopic.php?p=*
Disallow: /forum/viewtopic.php?f=*&t=*&start=0$
Disallow: /forum/viewtopic.php?f=*&t=*&view=next
Disallow: /forum/viewtopic.php?f=*&t=*&view=previous
Host: lastforum.ru
Sitemap: /forum/sitemap.php
Clean-param: sid /forum/index.php
Clean-param: sid /forum/viewforum.php
Clean-param: sid /forum/viewtopic.php

The error_reporting directive of the php.ini configuration file is responsible for the level of error handling in PHP. This parameter defines the types of errors that PHP informs about by outputting a text message to the browser window.

Possible directive values

Error levelConstantError description
1 E_ERRORCommon function errors (fatal errors)
2 E_WARNINGCommon warnings (non-fatal errors)
4 E_PARSEParser errors
8 E_NOTICERemarks (anomalies in the code, possible sources of errors - should be disabled if there is Russian text in the code, since correct operation is not ensured for international encodings).
16 E_CORE_ERRORHandler errors
32 E_CORE_WARNINGHandler warnings
64 E_COMPILE_ERRORCompiler errors
128 E_COMPILE_WARNINGCompiler warnings
256 E_USER_ERRORUser errors
512 E_USER_WARNINGUser warnings
1024 E_USER_NOTICEUser notifications
E_ALLAll errors

The above values ​​(numeric or character) are used to construct, which specifies the error message to display. You can use bitwise operations to mask certain types of errors. Note that only ‘|’, ‘~’, ‘!’ And ‘\ &’ will be understood in php.ini and that no bitwise operations will be understood in php3.ini.

In PHP 4, the default for error_reporting is E_ALL & ~ E_NOTICE, which means it displays all errors and warnings that do not have an E_NOTICE-level. In PHP 3, the default is E_ERROR | E_WARNING | E_PARSE means the same.

Note, however, that since constants are not supported in PHP 3 in the php3.ini file, the error_reporting setting must be numeric; that is, 7 by default.

Configuring with php.ini

The error_reporting parameter allows multiple levels to be set using bitwise flags. For example, level:

Error_reporting = E_ALL & ~ E_NOTICE

allows you to display all errors, except for comments.

And in order to show only errors (excluding warnings and notes), the directive must be configured as shown below:

Error_reporting = E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR

Customizing with .htaccess


php_flag display_errors On
php_value error_reporting E_ALL

Configuring with PHP

We turn on the output of errors in the browser window and set the required level.

Read also: