This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

starting php script

Old posts that have not been replied to for several years.
Locked
b
bit

starting php script

Post by bit »

Hi,

how can my tcl script start a php script?

I tried
exec php /path/to/filename.php

The script does not start, but only gives the following error:
Tcl error [notify]: child process exited abnormally

When I call php /path/to/filename.php from the shell it works.

Hope someone can help me.

bye,
bit
Last edited by bit on Mon Oct 13, 2003 8:44 am, edited 1 time in total.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

maybe set the path of /your/lib/path/php ....
XplaiN but think of me as stupid
b
bit

Post by bit »

that does not help
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

what is your os ?
i suppose linux ? or windows ? if its windows try -n on startup this will bring bot to forground, but you can install it as a service and run it as a system account and move it back to the back ground .. if you use linux witch you probably are useing try same if it works use screen to move it to back ground not sur on linux tho never executed files from an eggdrop with in linux but i gues its the same .. so try -n mode and see if it works. also why you wana use this php script ?

but you will need to set the path to your lib like

if you wana execute file thats in /sbin set path to /sbin/file
XplaiN but think of me as stupid
b
bit

Post by bit »

Ofloo wrote:what is your os ? i suppose linux ?
yes. SuSE Linux 8.2

Ofloo wrote:so try -n mode and see if it works.
i does not work :(

Ofloo wrote:also why you wana use this php script ?
because I have a ready php script and don't want to / cannot rewrite it in tcl
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: starting php script

Post by CrazyCat »

bit wrote:When I call php /path/to/filename.php from the shell it works.
Do you try it with your eggdrop username?
If no, verify the rights.
And peharps you'd better try:

Code: Select all

exec /path/to/php /path/to/filename.php
If it's always bad, try using wget or lynx, as:

Code: Select all

exec lynx -preparsed 127.0.0.1/filename.php
b
bit

Re: starting php script

Post by bit »

CrazyCat wrote:Do you try it with your eggdrop username? If no, verify the rights.
yes, I was logged in with my eggdrop user
CrazyCat wrote:And peharps you'd better try:

Code: Select all

exec /path/to/php /path/to/filename.php
I tried this already, but it didn't help
CrazyCat wrote:If it's always bad, try using wget or lynx, as:

Code: Select all

exec lynx -preparsed 127.0.0.1/filename.php
great, that works :D :D :D
thank you very much
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

BEWARE

Post by CrazyCat »

Use it carrefully, 'cuz if your php isn't well debugged, you may have a ghost process...
Try putting a timer (about 30s) wich halt the process (return 0?)
b
bit

Re: BEWARE

Post by bit »

CrazyCat wrote:Use it carrefully, 'cuz if your php isn't well debugged, you may have a ghost process...
Try putting a timer (about 30s) wich halt the process (return 0?)
could you give me an example how to do that?
S
SkIRmiS

Post by SkIRmiS »

The script does not start, but only gives the following error:
Tcl error [notify]: child process exited abnormally
I think it is because the TCL does not support execution of programs with exit code non zero. When you are finishing your execution, the php script is returning something that is not apear to be 0, regrettably TCL is expecting 0 and gives you: Tcl error [notify]: child process exited abnormally .

The easiest way to avoid it is to use catch procedure. Example:
catch { exec .... } error_message. Now all error will go to variable error_mesage.
2nd example:

if {[catch {exec grep teste /etc/smb.con} error]} {
puts "I got error: $error"
}

It should help you.
Locked