Dislike Help Report PHP. How to find a mistake in your code? Set up the maximum file size for your error records

20.6K.

PHP is an embedded server programming language. Most of its syntax is borrowed from C, Java and Perl. And also added a pair of unique features only for PHP functions. The main goal of this language is the creation of dynamically generated PHP HTML pages.

Php in html

When creating complex web pages, you will come across the need to combine PHP and HTML to implement specific tasks. At first glance, this may seem difficult, as PHP and HTML are two independent disciplines, but it is not. PHP is designed to interact with HTML, and its code can be included in the page markup.

In HTML pages, the PHP code is included with the help of special tags. When the user opens the page, the server processes the PHP code, and then sends the result of the processing (not PHP code) In the browser.

HTML and PHP are quite simple to combine. Any part of the php script outside the tags It is ignored by the PHP compiler and is transmitted directly to the browser. If you look at the example below, you can see that the full PHP script may look like this:

Hello today.

The above code is the usual HTML with a small php fragment that displays the current date using the built-in Date function. In this case, all HTML will be ignored by the PHP compiler and transmitted to the browser unchanged.

Integrate PHP in HTML is really very easy. Remember that the script is an HTML page with the inclusion of a specific PHP code. You can create a script that will contain only HTML (without tags), and it will work normally.

More advanced methods:

  • Menu Item.


and the result:

PHP in HTML with short_open_tag

If you need to cut the code as much as possible before in PHP insert HTML, you can use short_tags. As a result, it will not be necessary to entershort_Tags" from " Off" on the " ON.". Although on most servers, this parameter is already enabled, it is always better to check it manually. A problem that may occur when using short tags is a conflict when using XML. In XML syntactic expression

PHP in HTML with SHORT__TAG

Hello, Today is.

Keep in mind that if you need to create a site compatible with the maximum number of platforms, when inserting PHP in HTML should not be relying on short_tags.

HTML in PHP using Echo

Another way to integrate HTML to the PHP file is the ECHO command :.

This will affect the backlight of the markup in most editors. Therefore, it is necessary to allocate all double quotes inside the HTML code using the reverse braid.

PHP in HTML - file extensions

For a standard customized web server:

AddHandler CGI-Script .html .htm

For web server with running FastCGI:

AddHandler FCGID-Script .html .htm

HTML in PHP.

You can also use HTML code in PHP scripts. All you need to do is when opening a page with PHP change the order of opening HTML and PHP tags.

In this lesson, we will learn such things like hiding PHP errors. Along the way, we will also discern how it is not easy to suppress the output of these errors, but also how to record them into the log file, how to protect this log file, how to configure PHP error messages (how serious errors show, show warnings), learn how to set the maximum size Lines of error and turn off recording of repeating errors.

Do I need to hide PHP errors

PHP errors give the most diverse information that allows the striker to collect data about your site and your server. But if this question was a unambiguous answer "yes", then everything would be solved by adding to each file with PHP programs of one single line

Error_Reporting (0);

In fact, all errors, including warnings (non-critical errors), should be displayed at the test stage. The output of errors and warnings will also help to understand the existing (or possible) problems in the work environment. You should not suppress the output of errors and warnings in programs intended for free distribution, since if there are problems, all reports of users about problems will be the same: "There is a white screen", which greatly makes attempts to understand.

In general, on servers designed to develop (for example, on a home server), you do not need to remove errors and PHP warnings using methods error_Reporting (0); and @ - You need to study their causes and correct the source code.

On the working servers it is extremely recommended not to show all the errors that occurred in the PHP code, but it is recommended not to simply suppress their display, but also to conduct their log, write for the system administrator and for a programmer to PHP - from these logs they will receive important information about possible Problems on the site / server.

How to enable PHP error logging via.htaccess

In this part of the lesson, I will show Apache users how to suppress PHP error output and hide them from visitors, and PHP error record will be enabled for further analysis, all this setting will be implemented via file.htaccess.

In general, this method has another wonderful advantage - instead of trying to transfer all PHP errors and warnings, we will write every one of them to our personal log, thanks to this, no error arisen, even if it has no you, And someone has a visitor to your site under conditions that maybe it would not even mind to simulate. Thanks to a simple way to implement this effective strategy.

Hide php mistakes from visitors

There are different ways to suppress PHP errors through.htaccess. This can be done on the following directives .htaccess into the file of your domain httpd.conf or in the root (or any other target directory) file.htaccess with the following contents:

# Press PHP_Flag Display_STARTUP_ERRORS OFF PHP_FLAG DISPLAY_ERRORS OFF PHP_FLAG HTML_ERRORS OFF PHP_VALUE DOCREF_ROOT 0 PHP_VALUE DOCREF_EXT 0

This will lead to the fact that PHP errors will no longer be public on your site. This eliminates potential security risks, and does not give this ugly, incomprehensible PHP errors to break the clash of your site and disorient your visitors. Code editing for this is not required.

Enabling PHP PHP Magazine

Now that we hide PHP public errors, let's turn on their logging (recording) so that we can track them. This is done by adding the following directives .HTaccess to the file of your httpd.conf domain or your file.htaccess, which is located in the root (or any target) directory.

PHP_flag log_ror_log / php_value error_log /home/path/public_html/domain/php_html/domain/php_html/domain/php_html/path

To make it earlier, you need to edit the path in the last line according to the actual location of your php_errors.log file. Of course, along with this you need to create this file and give it a resolution of 755 or, if necessary, 777. Finally, you need to secure this log file by adding these final lines of the code to your file.htaccess:

# Prevent access to the PHP log error

Now that everything is in place, check that everything works as it should call several PHP errors. You may also want to check the protection of your log file, trying to get access through the browser.

Advanced PHP error handling using.htaccess

Let's now be deeper in this topic, add additional functionality and exploring various implementations. First of all, we investigate work with PHP errors for the working environment (for example, for websites and applications that are online, are active and are public), then we will look at work with errors for the developer's environment (for example, for projects under development, testing , private, etc.).

Control PHP error message

Using.htaccess It is possible to configure the error message that is suitable for your practical needs. Common Fort to control PHP errors Next:

# General view of the directive to configure the error level PHP_VALUE Error_Reporting digit

There are several common values \u200b\u200bthat can be substituted instead of "digit", including:

  • The most complete error message (Complies with E_ALL) - To do this, use the value "32767".
  • Full error message - To complete PHP errors, use the "8191" error, which will enable the record of the total, except for the execution time notification about the use of outdated designs (code warnings that will not work in the following PHP versions).
  • Zend error message - To record both fatal and non-fatal warnings of the compilation time generated by the Zend scripting engine, use "192".
  • Basic error message - write down the execution time notifications. Indicate that during the execution of the script something happened that it may indicate an error, although this may occur with the usual execution of the program. To do this, use the number "8".
  • Minimum error message - Record only the fatal errors of execution time. These are unrelated tools for the script of errors, such as memory allocation error, etc. The execution of the script in this case is terminated. To do this, use the number "1".

Of course, you can use other values \u200b\u200b("numbers") for fine adjustment of which errors you want to fix. Some explanations on this issue at the very bottom.

Set up the maximum file size for your error records

Using.htaccess You can define the maximum size for your PHP errors. It is due to control of the size of each recorded error, and not the entire file as a whole. The syntax is as follows:

# General Directive to configure the maximum error size log_errors_max_len. Corolor_

Here, "purpose_none" represents the maximum size of each recorded error lines in bytes. By default, the value is "1024" (i.e. 1 kilobyte). To delete this limit, you can set the value "0". Remember,. This value is also used for the displayed errors when they are enabled (for example, during development).

Disable recording recording errors

If you have already managed to work with the error log, you might not pay attention that in it there are many similar entries that differ only by the time of events. You can get rid of this redundancy, just add these lines to the HTCCESS file:

# Turn off recording of repeating errors php_flag ignore_repeated_errors on php_flag ignore_repeated_source on

With such settings, repetitive errors will not be recorded in the gun, even if they happened in various sources or addresses. If you want to disable repeating errors from only one source or file, simply comment or delete the last string. And vice versa to make sure that your event log file includes all repetitive errors, change both values \u200b\u200bwith oN. on the off.

We collect all together - the work environment

Discusing the features of configuring PHP errors recording, let's collect all our records in one file.htaccess. These settings are optimized for the working environment.

# Processing PHP errors for the production server php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off php_flag log_errors on php_flag ignore_repeated_errors off php_flag ignore_repeated_source off php_flag report_memleaks on php_flag track_errors on php_value docref_root 0 php_value docref_ext 0 php_value error_log / home / path / public_html / domain / PHP_errors. log php_value error_reporting -1 php_value log_errors_max_len 0 Order Allow, Deny Deny From All Satisfy All

If you consider a good style code with explanations, the same code, but with comments:

# Processing PHP errors for your server # disable the startup error php_flag display_startup_errors off # disable all other errors php_flag display_errors off # disable error html markup php_flag html_errors off # to start recording php_flag log_errors on # errors include ignoring repeated errors php_flag ignore_repeated_errors off # disable ignoring error of the unique sources php_flag ignore_repeated_source off # turn record memory leaks php php_flag report_memleaks on # save the most recent errors via php_errormsg php_flag track_errors on # disable formatting reference links for errors php_value docref_root 0 # disable formatting reference links for errors php_value docref_ext 0 # specify the path to PHP_VALUE error_log /home/path/public_html/domain/public_html/domain/public_html/domain/public_html/domain/php_errors.log # Specify the record of all PHP PHP_VALUE error_reporting -1 # Disable the maximum length of the PHP_VALU error string E log_errors_max_len 0 # Protect error log file from public access Order Allow, Deny Deny From All Satisfy All

The given strategy is ideal for a public server in the work environment. All errors are hidden from prying eyes, while they are carefully going for administrators and programmers. Of course, you can customize the guidelines for yourself so that they are perfect for your tasks. And now let's consider the strategy of work with errors for the environmental environment.

We collect everything together - the environmental environment

Working out or debugging a program, it is more convenient to track the PHP errors that occur in real time, right in the browser. Example.htaccess with the appropriate settings for the development environment is shown below:

# Work with PHP errors for server developers php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_flag log_errors on php_flag ignore_repeated_errors off php_flag ignore_repeated_source off php_flag report_memleaks on php_flag track_errors on php_value docref_root 0 php_value docref_ext 0 php_value error_log / home / path / public_html / domain / PHP_errors .log php_value error_reporting -1 php_value log_errors_max_len 0 Order Allow, Deny Deny From All Satisfy All

Let's not explain each line - you can see the appropriate clarification of a little higher.

Tips

To find out the absolute path to the log file on the server using PHP methods (for the PHP_VALUE ERROR_LOG directive)

Echo Dirname (__ File__);

Example.htaccess for.

php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_flag log_errors on php_flag ignore_repeated_errors off php_flag ignore_repeated_source off php_flag report_memleaks on php_flag track_errors on php_value docref_root php_value docref_ext 0 0 php_value error_log C: ServerdatahtdocsPHP_errors.log php_value error_reporting -1 php_value log_errors_max_len 0 Order Allow, Deny Deny From All Satisfy All

Does not work

This method is not applicable on hosting, where PHP works like CGI (Possible solutions will be shown in the following article).

-1 and ~ 0 to display all PHP errors

In directive pHP_VALUE Error_Reporting You can specify all errors to display -1 or ~0 . Those. Rows look like this:

PHP_VALUE Error_Reporting -1 PHP_VALUE ERROR_REPORTING ~ 0

And more correct is the second method, that is, using ~0 .

Predefined constants and broken operations ERROR_REPORTING

  • Predefined constants
  • Bitwise operators

For example, if we want to record only the following E_error errors (Value 1), E_WARNING (Value 2), E_CORE_ERROR (value 16), then to obtain an appropriate numerical value, it would be necessary to translate these values \u200b\u200binto binary numbers and produce the appropriate batch operations, and then obtained Binary number Translate to ten times. However, this operation can be simplified - sufficiently folded the values \u200b\u200bof decodent numbers. Those. In our case, it is 1 + 2 + 16 \u003d 19

PHP_VALUE Error_Reporting 19.

will display E_ERROR, E_WARNING and E_CORE_ERROR errors.

An example of an absolute path to the file log on Hostland hosting (for PHP_VALUE ERROR_LOG directive)

/home/host900456/sight/blogs/htdocs/www/php_errors.log.

Instead hOST900456. You need to specify your account.

Instead website You need to specify your domain.

By the way, a good hosting that works this very site. Recommended!

The permissible load coefficient on the server is one of the parameters of SaaS accounts. For each tariff plan installed their load parameters. With the current account of the account you can always read the CRM System Personal Account.

Sometimes there may be such a situation that the account used will produce a load, which is higher than allowed on your tariff plan. You will be notified about this by the corresponding letter.

The main parameters affecting the load:

  • Number of users in the system of working at the same time;
  • Number of records in the tables of the program;
  • The number of rules and access groups;
  • The number of reminders, color formatting, filters, etc.;
  • The number of calculations and their complexity;
  • The number of tasks performed in the background (through the CRON system);
  • Number of launched mailing (email and SMS);
  • Number of reports;
  • The volume of the program log.

Therefore, if some access groups, color formatting, filters and other configuration items are not used, it is desirable to delete them. You can also delete unnecessary records from the tables. In addition to deleting configuration items, other measures can be taken to reduce the load on the server. About them details the speech will go below.

All measures to reduce the load can be divided into two parts: for administrators and for developers. These measures can also reduce the load on the server when using the Web version of the program.

Instructions for administrators

Start optimization

The most first action you have to do is make sure that you use the latest version of the program. You can verify this by going to "Settings" - "Advanced" - "Refresh Revision". If you use the latest version and revision of the program, you will see the appropriate message.

If you are using an old version or revision, the program will suggest you to upgrade.

Next, you should run an extended system check. To do this, go to "Settings" - "Advanced" - "System Check" and click on the "Extended System Check" button. In case of errors in the program, they will be automatically corrected.

General program settings

Go to "Settings" - "Advanced" - "General Settings". It is worth paying attention to two points.

Intuitive search - you can disable this option if you do not need a search for value transliteration.

Scrolling mode window - You can read more about the modes of the window. You can read in our documentation. It is advisable to specify this setting the value "simple".

Settings CRON.

Go to "Settings" - "Advanced" - "CRON Settings". In the CRON settings, you can control the tasks running automatically in the background. For example, synchronization, sending letters and SMS. Reduce the load due to this setting in two ways.

1. To prohibit the execution of tasks that you do not use in your program. You can do this by opening the desired task and putting a tick "Prohibit execution."

For example, if you do not use the synchronization function, then open the appropriate task and check the "Disable execution" checkbox in its settings. If you do not use the SMS send function - you can prohibit the execution of the "SMS" formation tasks, "Sending SMS", "Check the SMS delivery status".

2. Change the frequency of tasks. You can do this by entering the settings of the job and changing the value in the "period" field. For example, in the message "Sending letters", you can specify instead of every minute execution, the execution of the task once in 5 minutes.

Setting the calculation conditions

In the CRM program to automatically fill some fields using calculations. But sometimes the conditions for their implementation are non-optimal. For example, the load causes the "field display" condition in the calculation setting. It should be avoided.

For example, if we have a calculation for which the amount of fields B and B is introduced in the field A, it is desirable to use the Conditions of the Field B "and" Change Field B ". If we have a calculation that enters the value from another table from the field b, depending on the value in the B C connection field, it is logical that you can only use the "Changing the Field" and "Saving Table" condition.

Setting and archiving logs

Go to "Settings" - "logs" - "Log Setting". In the log settings, it is not necessary to turn on the user logging by the user of the tables, views and records. This can how to increase the load on the server and bring to the fact that the file with the logs will be too large. It is also here to include the option "Make a monthly archiving of a log", which will allow you to automatically automatically reduce the size of the table with logs

Also here you can automatically archive logs, if automatic archiving has not been turned on. You can do this in the "Archive" tab.

Setting up filters

If you open the settings of any filter, you can see the "Display in brackets" option. It is advisable to remove this tick, because This option may cause a load with each opening of the table. And the more such filters in the table - the greater the load when opening.

Instructions for developers

Working with a PERFOMANCE_STAT table

Important: Making changes to the database tables can lead to the inoperability of the program. Do not make changes to the database table without an extreme need.

Enter your account, and open the HTTPS address: // * Address your account * / edit_sql.php (where instead of * address of your account * Specify the corresponding value). In the window that opens, go to the database table containing the name of your account (for example, C_MYACCOUNT). In the list of database tables that opens, open the F_PERFORMANCE_STAT table

This table keeps accounting for all program scripts for the last hour. To begin with, you should sort all scripts in this table by the number of SQL queries (from more to the smaller). For this, double click on the "SQL_COUNT" header.

After the data is sorted, you can start analyzing data. When conducting an analysis, you should pay attention to two columns

1. Script - indicates the name of the script that issues the load

2. Get_Data - provides more detailed information about the script, or contains a reference to a table / task in which the load occurs.

For convenience of analysis, use the table below:

Value in the "script" field Example value in the "Get_Data" field Description Actions to reduce the load
cron.php. ... & task_id \u003d 1 The line of this type means that the load gives one of the tasks in CRON
You need to go to "CRON settings" and open the task that causes the load (the task ID is specified in the "get_data" field). It is necessary to either optimize the task code, or reduce its frequency. About CRON settings.
view_line2.php. table \u003d 42 & Line \u003d 1 & Filter \u003d 48 & Page \u003d 1 A string of this type means that the load gives one or more calculations in a specific table when viewing the record
fields.php. table \u003d 42 & Filter \u003d 48 The line of this type means that the load gives one or more calculations in a specific table when viewing the table You must go to the settings for the calculation of the table specified in the "Get_Data" field (in the example, this is a table with ID 42). To begin with, it is worth viewing and optimizing the conditions for performing calculations in the specified table. If this does not help, it is worth optimizing the calculation code itself.
report.php. id \u003d 30. The string of this type means that the load gives one of the program reports.
It is necessary to optimize the report code specified in the "get_data" field (in the example, this is a report with ID 30).
December 29, 2012 at 22:01
  • Microsoft SQL Server

We continue to consider useful tips for beginners, when creating reports in Microsoft Reporting Services.
The beginning can be found here:
Interested, please under the cat ...

0) How to place multiple controls in the table cell?
Quite often there is a need to place several controls in 1 cell table. If you just drag the control to the cell, it completely fills it. Control, called Rectangle, helps to exit this situation.

Rectangle is an analogue of the PANEL control used in WinForms, this is a certain playground for placing controls. When placed in the cell, the Rectangle fills the entire cell of the table creating a "platform" to accommodate other controls.

1) Specify the default report language
When creating reports, try to declare the report language (Report Properties - Language).

It is very useful if you work with a foreign client whose regional settings differ from yours. If you do not know what settings use your client, that is, the ability to specify the example of the following content:
\u003d User! Language
By this you will avoid irregularities in formatting numerical values, date, time, currency, etc. which expect a client.
2) Concatenation of strings
Sometimes there is a need to "insert" into the static report text, located for example in Texbox, the field value from the database. In other words, it is necessary to fold the lines of the text in 1 string. To do this, SSRS provides the Operand "&".
Suppose in TEXBOX we have a static text "Hello, uv. Ivan Ivanovich…". We need instead of Ivan Ivanovich to substitute the name from the database from the FIO field. To do this, right-click on Texbox, call the context menu, select the Expression property in Texbox and change the text as follows:
\u003d "Hello, uv. "& Fields! FIO.VALUE &" ... "
uPD: As suggested in the commentary, the most correct way to concatenate rows is to use Placeholder.
It is easy to use it: in Texbox, you need to set the cursor to the place where it is supposed to insert the value from the database field. Right-click the context menu and select "CREATE PLACEHOLDER ..."

Set the Label value (this value will be seen in the text, if you do not specify the value for the LABLE field, the field name from the database) will be used) and Value (in our case, this field from the database)

PLACEHOLDER uses additional benefits:
1) seen the text that is in the control (in the method that I described, the user sees only the text <> What introduces a person who sees the report code for the first time in confusion and spends its time on finding the desired expression.)
2) Placeholder allows you to format the field formatting (set the data format, change the font, color, alignment, etc. without changing the formatting of the main text.

The difference "on the face":

3) Methods for formatting numeric data
SSRS provides several features to format the data. The simplest formatting method is to specify the format (Format property) in the control properties.

This method has 2 disadvantages:
1) Control contains in addition to the data that is supposed to format also additional text.
2) when exporting a report in HML
It is possible to solve this problem by calling special methods. Consider an example:
TextBox contains the following text: "Dear Customer, the balance of funds in your account is:" & Fields! UserBalance.Value & "Rub." .
If you do not format, then provided that the fields value! UserBalance.Value is 1005.35 can be displayed as 1005.350000000000. To avoid such a casus, you must use the method Format.or Formatnumber.
Example of use: "Dear client, the balance of funds in your account is" & Format (fields! UserBalance.Value, "#, ## 0.00") & "rub."
"Dear customer, the balance of funds in your account is" & Formanumber (Fields! UserBalance.Value, 2) & "Rub."
When using Format, you must use the formatting mask, when using Formanumber, it is enough to specify the number of semicolons.
Note: The Format method is also applicable to format the date, time, money, etc.

4) Export of the report to the CML format setting fields
SSRS allows you to export a report to different formats, one of them is HMD. Each report control has 3 properties that are responsible for behavior when exporting to HML.

Consider them closer:
DataElementName.- responsible for the name of the element in the hML, the default value is not executed. If you do not execute this item, then the name in the hML will correspond to the name of the control.
DataElementOutput- The property is responsible for that there will be an element exported to HML or not. The values \u200b\u200bthat can be set:
AUTO.(Default value) - the element will be exporting in that case if it matters if NULL value is not exported.
Output.- The element is always exported.
Nouutput- element in hml is not exported
DataElementStyle- responsible for the element element in HML (it will be an element or attribute)
Values \u200b\u200bthat can be used:
AUTO.(Default value) - Depending on the control, will be exported as an element (ATTRIBUTE). In fact, only Texbox is exported by default as an attribute, the remaining elements of the form of nodes.
Attribute.- the value will be presented as an attribute
Element.- The value will be presented as an item (Node)
An important chip: The Hidden property does not export the HIDDEN property. Therefore, if it is supposed to export an element that is shown or not on the basis of the condition, this condition should be transferred to Expression control. Example: TextBox contains text that is shown only in case when the Condition field \u003d 1. Then expression will look like this:
\u003d IIF (Fields! Condition.value \u003d 1, "Some Text", "")

Today everything should be continued.


1. Make sure you see error messages if they occur.
To do this, add 2 lines to the start of the script
ini_set ("display_errors", 1);
error_Reporting (E_ALL);

Although in some cases it will not help any equal. Then watch the errors in the web server logs.
You can also add to file.htaccess line
pHP_FLAG Display_errors 1.
Be sure to remove all dogs (@) from the code!
If the Apache gives an error 500 - it means you want to watch the text of the error in the web server error log.

2. If problems with MySQL functions occur (for example, "Supplied Argument Is Not A Valid MySQL Result Resource") - this means that mysql_query () was executed with an error. To always be aware of such errors, the MYSQL_Query function must be called like this:

$ SQL \u003d "SELECT * from Table";
$ Res \u003d Mysql_Query ($ SQL) or trigger_error (mysql_error (). "IN". $ SQL);

If MySQLI is used, then write 1 line in front of the connector:
mysqli_report_error | mysqli_report_strict);

3. When working with imagesTo see an error message, it is necessary to guess to turn off the output of the header, speaking the browser, which is next to the picture.
And, of course, contact the script directly, and not through the tag !

4. When problems in the aplobe, first of all, see the $ _FILES array ( print_R ($ _Files);). Descriptions of errors from $ _files ["FileName"] ["error"] is in the manual.

6. Commit a line with the header ("Location:") if you are looking for an input in the POST request processor

7. When debugging AJAX requests, see the server response in Firebug-E and its analogs (F12 button in any browser), the Network tab - Preview.

8. And the most important thing: running script, see not what the browser shows, but the source HTML code!.

After receiving an error message, you can read it and fix it.
If you did not cope - write to the forum. At the same time copy an error message, and copy a small - 3-5 rows - a piece of code that the error indicates. I repeat - copy! No discard!

If you still did not find a mistake - read on:

Remember - you work on PCP only with rows! HTML page that you create a script is for PCP just a set of rows! He no difference that in this set - the IMG, Script or Frame tags. PCP for you will not make rows translations, it will not draw a javascript. If you do not know the javascript, then do not attempt to create a program on it using PHP.
Opening a connection with a remote host, you send a row to the socket, you get a row from the socket. PCP does not understand anything in these lines and will not be a dialogue for you! It's you should clearly understand what you want to send to the socket, and what to get! Therefore, take the Telnet program, connect with the desired host and try to do what you want to make the PCP.
If you do not work the script with sockets - running in the calf watch what is happening!
SQL query is a string. You must clearly imagine what kind of request will be as a result of your cunning PCP code! The database server does not understand the designs of Intval, Date, Mktime, and so on! This is all PCP code. The result of which will be the string of the correct SQL query. Before writing a PCP code, you must clearly imagine how the SQL query should look like a result!
If you do not run SQL query 0 Take it down on the screen and see what they were spinning with your script!

Conclusion.
Debugging is the main occupation of a programmer.
Debugging is the only and most powerful way to find an error in the program.
Debugation consists of two main components:
1. Simplify the example as much as possible. If your program does not work, which draws the form, receives the data, records these forms to the database and displays them again, then scroll the program to the components and follow in turn.
If you do not work as a complex subprogramm definition of performance of cooks - write first test in two lines to make sure that you at least you can expose and read the cook.
2. The output of debug information.
Check the value of each variable! Each value returned by the function!
Does not work lococked? Display it on the screen and copy to the browser!
Is the file written an empty string? Check the components of this string at each stage of its creation and display it!
Make sure that the screen is displayed? Care write to a file on testa Row! Scored directly to the script! Reduce the number of unknown!
And always see not what the browser shows, but the source HTML code!

I hope that I could at least explain the principles of this classes.
Successful debugging.

Did you like the article? To share with friends: