_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Introducing JavaScript
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
The Web Warrior Guide to Web Design Technologies
Objectives Using functions to organize PHP code
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Guide To UNIX Using Linux Third Edition
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Introduction to C Programming
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
PHP : Hypertext Preprocessor
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
Writing Web Pages By Shyam Gurram. Agenda Writing Web Pages Delimiting PHP Program Units. Displaying Output to Web Pages Putting Comments in PHP Programs.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
1 JavaScript in Context. Server-Side Programming.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Diagnostic Pathfinder for Instructors. Diagnostic Pathfinder Local File vs. Database Normal operations Expert operations Admin operations.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
JavaScript Errors What Could Possibly Go Wrong WCPGW- A statement of unbridled optimism and also an immediate trigger for Murphy's Law. Generally uttered.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Fall 2004CSI University of Ottawa Introduction to PHP Basic principles and syntax.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
XP Tutorial 8 Adding Interactivity with ActionScript.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
CS116 COMPILER ERRORS George Koutsogiannakis 1. How to work with compiler Errors The Compiler provide error messages to help you debug your code. The.
PHP Reusing Code and Writing Functions 1. Function = a self-contained module of code that: Declares a calling interface – prototype! Performs some task.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
Creating FunctionstMyn1 Creating Functions Function can be divided into two groups: –Internal (built in) functions –User-defined functions.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
CITA 310 Section 4 Apache Configuration (Selected Topics from Textbook Chapter 6)
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Testing and Debugging.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Intro to PHP & Variables
Conditions and Ifs BIS1523 – Lecture 8.
PHP.
Web DB Programming: PHP
An Introduction to JavaScript
Presentation transcript:

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the book authors, 2002 PHP Bible Chapter 15: Basic PHP Gotchas

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition2  Wiley and the book authors, 2002 Summary Installation-related problems Blank and incomplete pages Parse errors Permissions problems Unbound variables Function problems Math problems

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition3  Wiley and the book authors, 2002 Installation-related problems Of course none of these problems will appear on the class' webserver, we'll go over some of the more common ones Symptom: Text of file displayed in browser window  If your seeing your PHP script instead of the output HTML, check that you are accessing the site by http rather than the file system (e.g. instead of file:/home/mypage.php) Symptom: PHP blocks showing up as text  Filename extensions used for PHP are not associated to the PHP engine or you didn't give the file a PHP extension (e.g..php) Symptom: Server or host not found/Page cannot be displayed  DNS or web-server configuration issue. Try pinging the host by name & IP. If the name doesn't resolve but the IP does, it's a DNS issue. If the name resolves & pings, it's a web-server config issue where the server is probably not bound correctly to port 80

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition4  Wiley and the book authors, 2002 Rendering problems Symptom: Totally blank page  Probably an HTML problem where you are not outputting the proper HTML tags. Try viewing the source in the browser to see what errant code was output Symptom: Document contains no data  PHP module may not be working correctly (try browsing another page in the same directory). Your code may not be outputting any HTML. Your PHP may be crashing before output can be generated (insert some print statements throughout your code so you can see where it is failing). Symptom: Incomplete or unintended page  Usually bad HTML (view your HTML output, save it to a file, and run it through an HTML validation tool) Symptom: PHP code showing up in browser  May be missing a PHP start tag

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition5  Wiley and the book authors, 2002 Failures to load page Symptom: Page cannot be found  If other things are working, you are probably misspelling the file name (capitalization must match, spaces, etc.) Symptom: Failed opening [file] for inclusion  Misspelled included file name, incorrect directory permissions, path not set correctly for include files in php.ini

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition6  Wiley and the book authors, 2002 Parse errors Symptom: Parse error message (e.g. Parse error: parse error in myfile.php on line 30)  Category of errors arising from mistyped or syntactically incorrect PHP code  Line number may or may not have  Missing semicolon  Missing dollar sign preceding a variable name  Mode issues (failing to close a PHP section then trying to output HTML  Unescaped quotes (trying to put a quote symbol into a string without putting a backslash in front of it)  Unterminated strings (failing to close off a quoted string can result in parse errors located far away)  Anything else

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition7  Wiley and the book authors, 2002 Unbound variables Symptom: Variable not showing up in print string  Variable probably not assigned. Check spelling & capitalization  Variable also may be out of scope. If accessing global variable from within a function, use the global construct Symptom: Numerical variable unexpectedly zero  Same as above

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition8  Wiley and the book authors, 2002 Function problems Symptom: Call to undefined function  Name may be misspelled, or function definition is missing  If function is located in an included file, the included file may not have been found (switch to using require_once )  Declaring the function as a variable ( function $my_func() )  Using parenthesis in array indices ( $my_array(5) ) Symptom: Cannot redeclare function  Two definitions exist with the same function name  Using include or require instead of include_once or require_once Symptom: Wrong parameter count  Too many arguments or too few when calling a function

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition9  Wiley and the book authors, 2002 Math problems Symptom: Division-by-zero warning  Dividing by or using a function that divides by a variable that is unbound or which had been assigned a value of 0 Unexpected arithmetic result  Check for unbound variables and precedence confusions. Add parentheses if you think precedence may be causing the problem Symptom: NaN or NAN  Means Not a Number which is a misnomer. It is a number which has no value (not even 0), any equality tests with other numbers will return false (even when comparing it with the value NaN)  Generally the result of a numeric, yet invalid value being passed into a PHP function (e.g. passing 45.0 into acos() )  Any equations where the NaN value is a part of the equation will result in a NaN value

_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition10  Wiley and the book authors, 2002 Time-outs Any download can occasionally time out before a complete page can be delivered. However, this shouldn't be happening frequently on your local development server. If it does, you may have an issue that has nothing to do with slow Internet connections or server overload. Most "interesting" reason for a time-out is an infinite loop Moster "interesting" reason for a time-out is infinite recursion (function which calls itself without having a way of stopping the process) Can also be the result of resource requests timing out (e.g. running a query on a DB back-end which takes too long to return). Directives can be given to PHP in files which have long queries, etc. to wait longer for the query to return.