-
Notifications
You must be signed in to change notification settings - Fork 300
Common errors
This page contains a list of common issues and errors you may encounter while trying to install or run Ajax Chat.
If you get such errors it means that you're printing content to the page before AJAX Chat could output header information, which must be done first.
Printing content to the page in PHP is done with echo or print, but there are other possibilities as well.
Everything you put before or after the PHP tags
<?php ?>will be output as well.
Some text editors add a Byte-order mark to files encoded in UTF-8.
Unfortunately, due to a PHP Bug, this is interpreted as content (before any PHP tags can be parsed) and will be printed to the page before the headers can be sent.
So to get rid of these errors it might help to use another text editor on the original PHP files of AJAX Chat which do not include Byte-order marks.
A good text editor to use for this is Notepad ++.
Why do non-IE users get XML Parsing Errors?
Internet Explorer (IE) doesn't handle XHTML web-pages served with its correct MIME type (content-type) application/xhtml+xml properly - the Microsoft browser displays the XML content without rendering it as a webpage.
As a workaround, AJAX Chat serves the chat page content as text/html for IE and as real XHTML for browsers which accept application/xhtml+xml.
Standard compliant browsers such as Firefox, Opera, Safari and Chrome which accept application/xhtml+xml as content-type will abort the web page rendering if the served content is invalid XML.
Instead they will show you an XML Parsing Error with a description and the line number where this error happened.
This is not a disadvantage of those browsers. Internet Explorer will show you an error report if served an invalid XML file as well - as a test, copy the following code and save it as test.xml:
<?xml version="1.0" encoding="UTF-8"?> <test>All modern browsers will show you an XML parsing error - which is correct, as the file is not a valid XML file.
So to answer the question:
Your web page content is probably no valid XHTML.
Quite likely you edited the template files of AJAX Chat without validating the produced XHTML content.
The produced content is the actual output of your chat on your website, not the template files themselves. AJAX Chat parses the template files and replaces the template tags with dynamic content - the result is the actual content you see in your webbrowser.
The easist way to make sure your web pages work in all modern browsers is to just test it with all modern browsers.
If everything is running well, you can validate your chat installation by using the W3C validator.
Note: You cannot just upload the template files, as these are no valid XHTML files due to the template tags. Best visit your chat installation with your browser and save the current page to disk - this file can then be uploaded on the W3C validation page.
As an alternative solution you have the possibility to change the content-type of the page produced by AJAX Chat by editing lib/config.php:
// The content-type of the XHTML page (e.g. "text/html", will be set dependent on browser capabilities if set to null): $config['contentType'] = 'text/html';
If you receive errors such as:
Notice: Undefined index: DOCUMENT_ROOT in ...or
Warning: main(custom.php) [function.main]: failed to open stream: No such file or directory in ...
During installation or while trying to use AJAX Chat, it is due to certain server setups that do not recognize the standard php variables we use to detect where your AJAX Chat is installed. Most likely your host is using IIS as opposed to Apache ( we recommend Apache for reasons like this ).
To fix these problems, you must tell AJAX Chat what directory it is installed in.
Open chat/install.php and chat/index.php in your source code editor. Then find/replace the following in both files:
define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');with
define('AJAX_CHAT_PATH', realpath(dirname(__FILE__)).'/');
Source: Errors during Installation
If chat lets you login and go to the public room, but gives the message:
Chatbot: Error: Connection Status : 405
IIS6 will have an option somewhere to specify a list of default pages to be looked for when a webpage is not specified in a URL. When IIS gets a URL like "http://www.mywebsite.com" with no page specified it looks in the list of default pages e.g. default.htm, index.htm, index.html etc. and serves the first one it finds. Your problem is almost certainly because your server's list doesn't contain index.php.
Try adding index.php to the list.
This bug appears to occur when PHP's magic_quotes_gpc is set to off in your server configuration.
You can fix this by changing the following line in AJAXChat.php:
if(get_magic_quotes_gpc()) {to
if(true) {
After installing AJAX Chat you get this error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in .../somedirectory/ajaxchat.php on line 44
You the following in the .htaccess file in the same directory as ajaxchat.php:
AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php
=This page contains the following errors: error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error.=