How to check your php script for bugs
However, web sites have to be developed and maintained properly to provide a good experience to your visitors. And one of the vital features of any web site is its scripting language. Like any other scripting language, PHP which means Personal Home Page or Hypertext Preprocessor, is a server-based HTML embedded scripting language to create dynamic web pages. Though most of the syntax of PHP is on similar lines like Java and C, but it has its own unique features that give PHP an edge above the other languages.
The best thing about the PHP script is that it is very simple and the programmer just has to work with the values of variables and not the types of variables. Also, PHP codes are more secure compare to JavaScript which makes it impossible for anybody to steal your PHP script. Additionally, it allows you to work with popular databases like Oracle, Sybase, Generic ODBC and MySQL.
Here is an example of simple PHP script.
<html> <head><title>Example</title></head> <body> <h1><?php echo "Hello World"; ? ></h1> <?php $txt = "this is how a PHP script looks like"; echo $txt; ?> </body> </html>
However, there can be errors and bugs in this PHP script, if the syntax is not written correctly. And it is very important for the website owners and programmers to make sure that the web site PHP script is error-free.
Normally, a web site programmer will go through the syntax and find out the actual problem and rectify it. However, there are ready-made PHP scripts available online that would help you to resolve your script problem.
However to check more about the PHP specifications you can type in the below script in your notepad and save it as info.php, and upload it to your web server.
<html> <head> <title> PHP Test Script </title> </head> <body> <?php phpinfo(); ?> </body> </html>
Now open your browser and type in – http://www.mywebsitename.com/info.php
This will immediately give you all the details about the PHP script which will help you to fix shortcomings in your PHP installation.
There are various web sites that allow you to browse and locate your PHP files and than they check through the syntax and display where exactly you need to make the changes and rectify the problem.
Posted by James on 2009-09-04 in the category " php "
