I was able to get the parse error fixed by putting <?php instead of <? for all the tags in talk.php
Anyway, now I ran into another problem where I keep getting this error
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\chatbot\src\admin\subs.inc:1) in C:\wamp\www\chatbot\src\talk.php on line 47
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\chatbot\src\admin\subs.inc:1) in C:\wamp\www\chatbot\src\talk.php on line 47
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This error sounds like the script is trying to send a header with session information after some content has already been sent to the browser.
session_start(); must be called BEFORE anything is output to the browser because this cookie is sent within the HTTP header.
Make sure there is absolutely nothing in the script which will produce output before session_start() - this includes any whitespace (spaces or line returns) before the opening '<?php' delimiter and also nothing in the script which will produce output before this function, i.e., echo or print statements...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since my move from Windows XP Pro to Windows XP Home I also moved from IIS to Apache using the exact same WAMP installer: WampServer.
When I recently installed the current release of Program E I believe the only changes I made was to replace <? to <?php in all the files, not just talk.php. Try this.
Kind regards,
Anne.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To me this sounds like an AIML related problem. Perhaps you should empty all the tables and re-run botloader.php in the /admin/ folder. See if this helps. Pretty sure it should do. If not, then open dbprefs.php and in the last line remove the @ symbol from the MySQL connection. In case this is causing the problem.
Kind regards,
Anne.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Should your problem persist, then please provide the following data:
Version of Program E used,
AIML set loaded (preferably with link),
Which inputs have been used,
Responses to those inputs
and any other modifications you have made.
Since you are running an environment that I use myself this problem should be solvable.
Kind regars,
Anne.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Version of Program E used: 0.9
AIML set loaded: the default that came with the package
Which inputs have been used: The first input i used was "hello", then I used "what"
Responses to those inputs: The first response to the input "hello" was "RESPONSE: My brain contains more than 22,000 patterns, but not one that matches your last input."
The second response to the input "what" is "I don't know that bot:" and any input after this will generate the same response.
Any other modifications you have made:none except for the <? to <?PHP. Also in the db_pref I had to change the path to point to the AIML file because the default was AIML_TEST/
Thanks for all your help Anne!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. It appears that you have the correct database setting and that there is a connection. (Deduction from the first reply with "..22,000..".)
2. The error the was returned "I don't know that bot:" comes from the function "replybotname($userinput,$uniqueid,$botname = "TestBot")"
To me this sounds like the bot Id or Botname wasn't avaialble. But since you're getting an AIML error for any of the inputs that follow I'm not sure what the problem is.
I'm inclined to say that it may have something to do with your cookie or security settings. Besides this, there is not much I can suggest.
Kind regards,
Anne.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you please elaborate on what you consider to be the issue?
To me it sounds like Subs.inc hasn't been created. Subs.inc is a file that is created when Program E is loaded with AIML and contains the substitutions that are performed by the engine before matching the input onto the stored AIML patterns.
Kind regards,
Anne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for responding. Let me back up and give you some system details.
Windows XP SP 2
PHP 5.2.6
mySQL 5.0.51b
Apache 2.2.9
I have made three changes to the existing code overcome previously reported problems:
1) changed all '<?' to '<?php'
2) changed all '$HTTP_POST_VARS' to '$_REQUEST'
3) changed line 92 in dbprefs.php from '$rootdir="../../aiml_test/";' to '$rootdir="../../aiml/";'
I have run botloader.php with the following output:
***
When this script is done running you should see text that says "DONE LOADING." If the script times out it is probably because your PHP is running in safe mode. If this is the case use the file botloaderinc.php to load your AIML files.
Loading startup.xml
Loading bot: 2
Loading data aiml file: std-65percent.aiml
Loading data aiml file: std-pickup.aiml
DONE LOADING
Inserted 312 categories into database
WARNING! You should password protect the admin directory or remove the botloader.php script or people may be able to abuse your server.
Click here to talk to the bot
execution time: 12.362584
Templates per second=25.237442269351
Templates per minute=1514.246536161
***
Subs.inc has been populated. It is a 14KB file populated with arrays such as the following:
I open talk.php and the type in the question 'What is your favorite color?' The result is as follows:
***
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\admin\subs.inc:249) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\talk.php on line 47
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\admin\subs.inc:249) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\talk.php on line 47
Warning: preg_replace() [function.preg-replace]: Empty regular expression in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\util.php on line 588
Warning: preg_replace() [function.preg-replace]: Empty regular expression in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\util.php on line 588
RESPONSE: In the context of INACTIVITY, I don't understand "."
execution time: 0.67996
numselects= 23
Input: [TEXT BOX] [SUBMIT BUTTON]
***
The post I responded to suggested the first error was because either an echo or print command was being sent to the html output before the session information. This may be the case; if I examine the html source for the ouput of these errors it begins with a regurgitation of the sub.inc file. I believe this is a result of the 'include "respond.php"' on line 40 of talk.php. Respond.php then includes util.php which in turn includes subs.inc on line 59 (which seems to be printing the contents in the talk.php output). All this occurs before the talk.php script gets to the session_start() command on line 47.
I'm thinking that perhaps this error and the preg_replace() ones may be due to differences in the default php.ini settings from 4.0 to 5.0, but I'm relatively new to PHP and don't know for sure.
Hope this all makes sense!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 'headers already sent' problem was caused by not changing the '<?' in the subs.inc file to '<?php', thus the subs.inc file was being written out in full in the header.
And, ummm, I forget what I did to get past the utils.php line 588 reg ex problem. Sorry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Response Object
(
[response] =>
My brain contains more than 22,000 patterns, but not one that matches your last input.
[patternsmatched] => Array
(
[0] => * : * : *
[1] => CATCHALL : * : *
[2] => SAY CONFUSION STATEMENT : * : *
)
[inputs] => Array
(
[0] => hello : I only hear that type of response less than five percent of the time : hello
[1] => CATCHALL : I only hear that type of response less than five percent of the time : hello
[2] => SAY CONFUSION STATEMENT : I only hear that type of response less than five percent of the time : hello
)
[errors] =>
[timer] => 0.038172
)
Ok I see
No response except for
I don't know that bot:
However, if I click the back button to the previous page and then click refresh a new response comes out.
Also it stays with the same input even though the input box is cleared. // I checked this in the db (conversationlog).
Thanks
Stephen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last night I did a futher analysis of your situation and it dawned on me that your installation might be just fine.
You tried to use the inputstring "HELLO". However, this is not a pattern in the AIML knowledgebase. Thus this will not result in a reply.
To my knowledge your installation works just fine. If you download a more complete AIML set from www.alicebot.org you will have a better responding chatterbot.
Kind regards,
Anne.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if someone have thoses problems, i fixed them by :
putting <?php instead of <? for all the tags in php files
putting $_REQUEST instead of $HTTP_POST_VARS in talk.php
replacing <input type="hidden" name="botname" value="<?php=$_REQUEST['botname']?>"> at line 72 in talk.php
by <input type="hidden" name="botname" value="<?php echo $_REQUEST['botname']; ?>">
3 hours of labor .....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get the folowing error when I run talk.php can somebody help me
Parse error: syntax error, unexpected $end in C:\wamp\www\bot\src\talk.php on line 132
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I have followed all of the instructions from the instructions.html file.
My environment is the following:
PHP Version 5.1.2
MySQL 5.0.18
programe-v.09
So here is what I did:
- I modified the dbpref.php to my db settings
- I was able to load the AIML files into the db by using botloader.php
Note: this was my execution time
execution time: 113.426102
Templates per second=209.413879003
Templates per minute=12564.8327402
- When I clicked to link to talk.php it gives me the following error
Parse error: syntax error, unexpected $end in C:\wamp\www\chatbot\src\talk.php on line 132
Could someone please tell me how to fix this? any suggestions? I've looked at previous threads but there is nothing regarding this.
Thanks
Stephen
steviechan83@gmail.com
I was able to get the parse error fixed by putting <?php instead of <? for all the tags in talk.php
Anyway, now I ran into another problem where I keep getting this error
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\chatbot\src\admin\subs.inc:1) in C:\wamp\www\chatbot\src\talk.php on line 47
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\chatbot\src\admin\subs.inc:1) in C:\wamp\www\chatbot\src\talk.php on line 47
This error sounds like the script is trying to send a header with session information after some content has already been sent to the browser.
session_start(); must be called BEFORE anything is output to the browser because this cookie is sent within the HTTP header.
Make sure there is absolutely nothing in the script which will produce output before session_start() - this includes any whitespace (spaces or line returns) before the opening '<?php' delimiter and also nothing in the script which will produce output before this function, i.e., echo or print statements...
Since my move from Windows XP Pro to Windows XP Home I also moved from IIS to Apache using the exact same WAMP installer: WampServer.
When I recently installed the current release of Program E I believe the only changes I made was to replace <? to <?php in all the files, not just talk.php. Try this.
Kind regards,
Anne.
Hi Anne,
Thanks for the quick reply. I changed all the <? to <?php and now I do not get any errors.
I changed every file even in the src/admin, src/xmlrpc.
Now when I go to http://localhost/chatbot/src/talk.php
I get an input form and only one Bot called "TestBot" to choose from.
I type 'hello' into the input and I get this as the response:
<i>
RESPONSE:
execution time: 0.00779
numselects= 9
</i>
There is no response. Then if I type 'hello' again. I get the following:
I don't know that bot:
RESPONSE:
execution time:
numselects= 0
Anything I input after this I keep getting the same response.
I have tried to determine what the problem is but I cannot seem to find out still.
Thanks
Stephen :)
To me this sounds like an AIML related problem. Perhaps you should empty all the tables and re-run botloader.php in the /admin/ folder. See if this helps. Pretty sure it should do. If not, then open dbprefs.php and in the last line remove the @ symbol from the MySQL connection. In case this is causing the problem.
Kind regards,
Anne.
Hi Anne,
I tried to reload all the tables and removed the @ in dbpref.php. However, there is still that problem.
I've checked the database and all the tables have 'testbot' id in there.
Also, tables that do not have any information is the gmcache, thatstack, and gossip. However, the rest of the tables do.
I will reinstall the program e again. Maybe i changed something by accident
Thanks for all your help :)
Stephen
Should your problem persist, then please provide the following data:
Version of Program E used,
AIML set loaded (preferably with link),
Which inputs have been used,
Responses to those inputs
and any other modifications you have made.
Since you are running an environment that I use myself this problem should be solvable.
Kind regars,
Anne.
Version of Program E used: 0.9
AIML set loaded: the default that came with the package
Which inputs have been used: The first input i used was "hello", then I used "what"
Responses to those inputs: The first response to the input "hello" was "RESPONSE: My brain contains more than 22,000 patterns, but not one that matches your last input."
The second response to the input "what" is "I don't know that bot:" and any input after this will generate the same response.
Any other modifications you have made:none except for the <? to <?PHP. Also in the db_pref I had to change the path to point to the AIML file because the default was AIML_TEST/
Thanks for all your help Anne!
OK, let's break it down.
1. It appears that you have the correct database setting and that there is a connection. (Deduction from the first reply with "..22,000..".)
2. The error the was returned "I don't know that bot:" comes from the function "replybotname($userinput,$uniqueid,$botname = "TestBot")"
To me this sounds like the bot Id or Botname wasn't avaialble. But since you're getting an AIML error for any of the inputs that follow I'm not sure what the problem is.
I'm inclined to say that it may have something to do with your cookie or security settings. Besides this, there is not much I can suggest.
Kind regards,
Anne.
Perhaps you can add the following code to talk.php at the very end, but before the ?>.
print "<pre>";
print_r ($botresponse);
print "</pre>";
It will give you the contents of the $botreponse object (i.e. Class) and it's variables. Can you please post what it returns.
Kind regards,
Anne.
Yes, I am having this problem too, most likely because the include respond.php statement above the session statements. Respond.php has the statement
require_once "admin/subs.inc";
which automatically prints the arrays defined in sub.inc. Thus a header is sent before the session is started/gotten.
Has anyone fixed this issue?
I'm also having problems with
the preg_replace empty regular expression in ...\src\util.php on line 588 & 599
What about this one?
Thanks in advance!
Can you please elaborate on what you consider to be the issue?
To me it sounds like Subs.inc hasn't been created. Subs.inc is a file that is created when Program E is loaded with AIML and contains the substitutions that are performed by the engine before matching the input onto the stored AIML patterns.
Kind regards,
Anne
Hi Anne,
Thanks for responding. Let me back up and give you some system details.
Windows XP SP 2
PHP 5.2.6
mySQL 5.0.51b
Apache 2.2.9
I have made three changes to the existing code overcome previously reported problems:
1) changed all '<?' to '<?php'
2) changed all '$HTTP_POST_VARS' to '$_REQUEST'
3) changed line 92 in dbprefs.php from '$rootdir="../../aiml_test/";' to '$rootdir="../../aiml/";'
I have run botloader.php with the following output:
***
When this script is done running you should see text that says "DONE LOADING." If the script times out it is probably because your PHP is running in safe mode. If this is the case use the file botloaderinc.php to load your AIML files.
Loading startup.xml
Loading bot: 2
Loading data aiml file: std-65percent.aiml
Loading data aiml file: std-pickup.aiml
DONE LOADING
Inserted 312 categories into database
WARNING! You should password protect the admin directory or remove the botloader.php script or people may be able to abuse your server.
Click here to talk to the bot
execution time: 12.362584
Templates per second=25.237442269351
Templates per minute=1514.246536161
***
Subs.inc has been populated. It is a 14KB file populated with arrays such as the following:
***
$gendersearch=array(
"/\bhe\b/ie",
"/\bshe\b/ie",
"/\bto him\b/ie",
"/\bfor him\b/ie",
"/\bwith him\b/ie",
"/\bon him\b/ie",
"/\bin him\b/ie",
"/\bto her\b/ie",
"/\bfor her\b/ie",
"/\bwith her\b/ie",
"/\bon her\b/ie",
"/\bin her\b/ie",
"/\bhis\b/ie",
"/\bher\b/ie",
"/\bhim\b/ie",
"/\ber\b/ie",
"/\bihm\b/ie",
"/\bsein\b/ie",
"/\bihn\b/ie",
);
[more here]
***
I open talk.php and the type in the question 'What is your favorite color?' The result is as follows:
***
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\admin\subs.inc:249) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\talk.php on line 47
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\admin\subs.inc:249) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\talk.php on line 47
Warning: preg_replace() [function.preg-replace]: Empty regular expression in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\util.php on line 588
Warning: preg_replace() [function.preg-replace]: Empty regular expression in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pgmE\src\util.php on line 588
RESPONSE: In the context of INACTIVITY, I don't understand "."
execution time: 0.67996
numselects= 23
Input: [TEXT BOX] [SUBMIT BUTTON]
***
The post I responded to suggested the first error was because either an echo or print command was being sent to the html output before the session information. This may be the case; if I examine the html source for the ouput of these errors it begins with a regurgitation of the sub.inc file. I believe this is a result of the 'include "respond.php"' on line 40 of talk.php. Respond.php then includes util.php which in turn includes subs.inc on line 59 (which seems to be printing the contents in the talk.php output). All this occurs before the talk.php script gets to the session_start() command on line 47.
I'm thinking that perhaps this error and the preg_replace() ones may be due to differences in the default php.ini settings from 4.0 to 5.0, but I'm relatively new to PHP and don't know for sure.
Hope this all makes sense!
Solved my problems.
The 'headers already sent' problem was caused by not changing the '<?' in the subs.inc file to '<?php', thus the subs.inc file was being written out in full in the header.
And, ummm, I forget what I did to get past the utils.php line 588 reg ex problem. Sorry
Also I used phpinfo() and my session is set to this:
session
Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary wddx
Hi Anne,
Input: Hello
Response Object
(
[response] =>
My brain contains more than 22,000 patterns, but not one that matches your last input.
[patternsmatched] => Array
(
[0] => * : * : *
[1] => CATCHALL : * : *
[2] => SAY CONFUSION STATEMENT : * : *
)
[inputs] => Array
(
[0] => hello : I only hear that type of response less than five percent of the time : hello
[1] => CATCHALL : I only hear that type of response less than five percent of the time : hello
[2] => SAY CONFUSION STATEMENT : I only hear that type of response less than five percent of the time : hello
)
[errors] =>
[timer] => 0.038172
)
Ok I see
No response except for
I don't know that bot:
However, if I click the back button to the previous page and then click refresh a new response comes out.
Also it stays with the same input even though the input box is cleared. // I checked this in the db (conversationlog).
Thanks
Stephen
Last night I did a futher analysis of your situation and it dawned on me that your installation might be just fine.
You tried to use the inputstring "HELLO". However, this is not a pattern in the AIML knowledgebase. Thus this will not result in a reply.
To my knowledge your installation works just fine. If you download a more complete AIML set from www.alicebot.org you will have a better responding chatterbot.
Kind regards,
Anne.
hello
if someone have thoses problems, i fixed them by :
putting <?php instead of <? for all the tags in php files
putting $_REQUEST instead of $HTTP_POST_VARS in talk.php
replacing <input type="hidden" name="botname" value="<?php=$_REQUEST['botname']?>"> at line 72 in talk.php
by <input type="hidden" name="botname" value="<?php echo $_REQUEST['botname']; ?>">
3 hours of labor .....
I get the folowing error when I run talk.php can somebody help me
Parse error: syntax error, unexpected $end in C:\wamp\www\bot\src\talk.php on line 132