| |
file name and class names inhibit server start
Forum /
Support Questions /
file name and class names inhibit server start
Reply
Subscribe
Start new thread
Syndicated Feed (RSS)
|
Displaying 1 to 2 of 2
|
Previous
1
Next |
| Author |
Message |
Chriscypher
Posts: 4
|
|
file name and class names inhibit server start - Posted: April 27, 2005 - 7:25 AM
|
Quote and reply
|
I am using phpBeans on OSX with php client.
obj/ files seem to require that they be named testxxxx.php or the phpBeans server will not start.
ie. server starts OK with obj files named this always:
test.php
Test2.php
test2.php
server does NOT start with identical obj file named this:
xTest2.php
TestX.php
Testx.php
Test3.php
test3.php
abc.php
I can change the name at any time, restart via restart.sh (or stop.sh/start.sh for that matter) with consistent results. Is their some weird caching in phpBeans? Are obj files names restricted or limited?
in the obj files, class names are also apparently limited:
the server will start with classes named:
BeanTest2
but NOT with class named:
BeanTest3
Bean_Testx
...and yes, I am changing the name of the init function as well.
These conditions occur across *system* restarts, as well.
I am truly baffled. Any help or insight would be great.
-c!
|
|
Back to top
|
|
Chriscypher
Posts: 4
|
|
Logging, file and class names, phpBeans_info.html - Posted: May 2, 2005 - 8:33 AM
|
Quote and reply
|
After struggling a bit to understand how this all fits together...
phpBeans will not start (connection failed) if any script in obj do not parse correctly.
To log errors and find these problems, create an empty text file somehwere and modify the phpbeans-server-1.0.0/conf/php.ini file as follows:
extension="sqlite.so"
log_errors = On
error_log="/full/path/from/root/error_log"
phpBeans is very particular about file and class naming:
the bean file must be named: myname.php
and in the bean file:
class Bean_myname extends PHP_Bean {
...
function Bean_myname (&$server) {
...
$this->namespace = 'myname';
Also, below is a block of code which will display phpBeans info. If for some reason the phpBeans server is not up you will see "Connection failed" message. If this happens, check the error_log you enabled above.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>phpBeans Info</title>
</head>
<body>
<h3>phpBeans info</h3>
<?php
// Set these parameters to reflect your config
include_once("/full/path/to/phpBeans.php");
define("PHPBEANSUSER", "theusername"); // change this to whatever phpBeans user is making the connection
define("PHPBEANSPASSWORD", "thepassword"); // change this to whatever phpBeans user password
// if you are not using default port on localhost, see below for additional changes
//---------Print an array-----------------------------------------------
function print_array($array) {
if(gettype($array)=="array") {
echo "<ul>";
while (list($index, $subarray) = each($array) ) {
echo "<li>$index <code>=&gt;</code> ";
print_array($subarray);
echo "</li>";
}
echo "</ul>";
} else
echo $array;
}
//--------------------------------
$client = new PHP_Bean_Client ('localhost', 3843, 2);
if (! $client->connect ()) {
die ($client->error);
}
if (! $client->authenticate (PHPBEANSUSER, PHPBEANSPASSWORD)) {
die ($client->error);
}
$object =& $client->getObject('server');
$uptime = $object->uptime ();
$uptime_timestamp = strtotime($uptime);
echo "<p>Server uptime: ". $uptime."</p>";
echo "<br><h3>Objects available on server</h3>";
print_array($object->listObjects ());
$object =& $client->getObject('log');
echo "<br><h3>Log info</h3>";
echo "<p>Objects called in last 15 minutes (or since last clear)</p>";
print_array($object->listAll ('object',strtotime("-15 minutes"),time()));
echo "<br><p>Methods called in last 15 minutes (or since last clear)</p>";
print_array($object->listAll ('method',strtotime("-15 minutes"),time()));
echo "<br><p>Users calling since uptime (or since last clear)</p>";
print_array($object->listAll ('user',$uptime_timestamp,time()));
echo "<br><p>Hosts calling since uptime (or since last clear)</p>";
print_array($object->listAll ('host',$uptime_timestamp,time()));
echo "<br><h3>Users on server</h3>";
$object =& $client->getObject('user');
print_array($object->listAll ());
?>
</body>
</html>
|
|
Back to top
|
|
Return to Top
|
|