Error in script

apps

#1

On this laconica install I’m getting this when I try to run the daemons:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/yadayada/blabnow.net/lib/event.php on line 53

Line 53 is empty but 52 forward says this:

protected static $_handlers = array();

public static function addHandler($name, $handler) {
if (array_key_exists($name, Event::$_handlers)) {
Event::$_handlers[$name][] = $handler;
} else {
Event::$_handlers[$name] = array($handler);
}
}

public static function handle($name, $args=array()) {
$result = null;
if (array_key_exists($name, Event::$_handlers)) {
foreach (Event::$_handlers[$name] as $handler) {
$result = call_user_func_array($handler, $args);
if ($result === false) {
break;
}
}
}
return ($result !== false);
}
}


#2

[quote]On this laconica install I’m getting this when I try to run the daemons:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/yadayada/blabnow.net/lib/event.php on line 53[/quote]
You’re not specifying the path to the PHP 5+ executable in the command. Also I hope you are not running these daemons (long-running background process PHP scripts that leak memory according to the documentation) on a shared server. From DreamHost Terms of Service:

“Servers are shared with other customers, and as such IRC-related activities or severely CPU intensive CGI scripts (e.g. chat scripts, scripts which have bugs causing them to not close properly after being run, etc.) are not encouraged. Any application that listens for inbound network connections (even if the application would otherwise be allowed) are not permitted. BitTorrent clients, proxy servers/scripts, IRC bots and bouncers (BNC) specifically may not be run on any DreamHost Web Hosting server. If your processes are adversely affecting server performance disproportionately DreamHost Web Hosting reserves the right to negotiate additional charges with the Customer and/or the discontinuation of the offending processes.”

And from the Laconica README:

“Some activities that Laconica needs to do, like broadcast OMB, SMS, and XMPP messages, can be ‘queued’ and done by off-line bots instead. For this to work, you must be able to run long-running offline processes, either on your main Web server or on another server you control. (Your other server will still need all the above prerequisites, with the exception of Apache.) Installing on a separate server is probably a good idea for high-volume sites.”

“Note that these queue daemons are pretty raw, and need your care. In particular, they leak memory, and you may want to restart them on a regular (daily or so) basis with a cron job. Also, if they lose the connection to the XMPP server for too long, they’ll simply die. It
may be a good idea to use a daemon-monitoring service, like ‘monit’,
to check their status and keep them running.”

Customer since 2000 :cool: openvein.org


#3

I’m on a PRIVATE server

But since we are quoting DH, you over looked this quote:

What’s so great about DreamHost PS?
You get your own protected CPU and memory!
You can burst up to much more CPU and memory!
Run all the crazy long-running processes you want… we don’t care!

:slight_smile:

Anyway, It does now where the path to PHP 5 is because it’s running the rest of the script, and the rest of the install. It’s just those lines that causing problems.

Anybody else have any suggestions?


#4

OK so you know that those lines are causing problems. The only thing special about those lines are that they require the object-oriented support find in PHP 5 since that is a class definition file (for an application that requires PHP 5.2.+). So this means that if you pass the code through PHP 4 you get … a parse error about unexpected tokens.

So what path to PHP are you using? Have you checked to make sure it is the right version by running ‘/path/to/php -v’ in a shell?

And in case you haven’t installed your own version of PHP, FYI at DreamHost PHP 4.4.9 cli is located at /usr/local/bin/php and PHP 5.2.6 cli is at /usr/local/php5/bin/php (at least on my server)

[code][machine]$ /usr/local/bin/php -v
PHP 4.4.9 (cli) (built: Sep 17 2008 11:04:03)
Copyright © 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright © 1998-2004 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright © 1998-2007, by Zend Technologies
[machine]$ /usr/local/bin/php event.php

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or
T_FUNCTION or T_VAR or ‘}’ in /home/.glob/username/event.php on line 52
[machine]$ /usr/local/php5/bin/php event.php
[machine]$[/code]

Customer since 2000 :cool: openvein.org


#5

I get this when I run it:

-bash: /path/to/php: No such file or directory


#6

Awesome! Thanks Atropos. But now how do I make it automatically run those scripts using php5?


#7

Well like you said they are being run by some version of PHP now, aren’t they? Find out how and change the path. Either the path is in the shebang line, or otherwise hardcoded into a cronjob or script, or its just a matter of prepending /usr/local/php5/bin to the PATH variable.

Customer since 2000 :cool: openvein.org