[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  PHP?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Fri 26 Nov 2004 05:16 AM (UTC)
Is it easy to implement PHP support for MC?
From PHP's install.txt:

ActiveScript is a windows only SAPI that enables you to use PHP script
in any ActiveScript compliant host, like Windows Script Host,
ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control.

As of PHP 5.0.1, ActiveScript has been moved to the PECL repository.
You may download this PECL extensions DLL from the PHP Downloads page
or at http://snaps.php.net/.

After installing PHP, you should download the ActiveScript DLL
(php5activescript.dll) and place it in the main PHP folder (e.g.

I hope this makes it as easy as a few code changes.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 26 Nov 2004 08:08 PM (UTC)

Amended on Fri 26 Nov 2004 08:09 PM (UTC) by Nick Gammon

Well, I've tried. I downloaded PHP and the activescript dll as you suggested. A few changes to MUSHclient to recognise PHP as a script engine, register the DLL and we are away, sort of.

The problem is:

a) I don't seem to be able to test without raising syntax errors in PHP; and

b) As soon as I get an error, I see the usual script error dialog box, but when I close that MUSHclient silently terminates (ie. with no error message, however without offering to save changed documents etc.)

I tried testing with:

/world.Note "Hi"

This usually works, however first I see this in the error dialog:

syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Then this is what I get in the debug window:

T=0000015e 01dcc6d0: GetScriptState(current=SCRIPTSTATE_CONNECTED)
T=0000015e ParseScriptText
T=0000015e pstrCode=001423E4 pstrItemName=00000000 
punkContext=00000000 pstrDelimiter=00000000 pvarResult=00000000 pexcepinfo=0012F990
T=0000015e [MARSHAL]  prepping for function code 0 ParseScriptText, 9 args, marshal defs at 01EDA01C
T=0000015e [MARSHAL] marshalling ... 
T=0000015e [MARSHAL]    arg=2 IUnknown(NULL) - skip
T=0000015e [MARSHAL]  -- skipping (this param is not needed in this direction)
T=00000141 [MARSHAL]  unmarshalling...
T=00000141 [MARSHAL]    unmarshal arg=2 IUnknown(NULL) - skip
T=00000141 ParseScriptText
T=00000141 pstrCode=001423E4 pstrItemName=00000000 punkContext=00000000 pstrDelimiter=00000000 
pvarResult=00000000 pexcepinfo=0012F990
T=00000141 01dcc6d0: ParseScriptText:
code=world.Note "Hi"
T=00000141 0014ee58: COMPILED FRAG
T=00000141 code to compile is:
code_offs=0  func=(null)
world.Note "Hi"
T=00000141 01dcc6d0: PHP Error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
T=00000141 raising error object!
T=00000141 Calling [marshall] m_pass->OnScriptError
T=00000141 Release: errobj refcount=1
CActiveScriptSite: OnScriptError
T=00000141 Release: errobj refcount=2
T=00000141 Release: errobj refcount=1
T=00000141 Release: errobj refcount=0
T=00000141 024f3b40: cleaning up error object
T=00000141 --- done calling m_pass->OnScriptError
The thread 0x15E has exited with code -1 (0xFFFFFFFF).
The thread 0x122 has exited with code -1 (0xFFFFFFFF).
The thread 0x125 has exited with code -1 (0xFFFFFFFF).
The thread 0x13C has exited with code -1 (0xFFFFFFFF).
The thread 0x153 has exited with code -1 (0xFFFFFFFF).
The thread 0x147 has exited with code -1 (0xFFFFFFFF).
The thread 0x167 has exited with code -1 (0xFFFFFFFF).
The thread 0x141 has exited with code -1 (0xFFFFFFFF).
The program 'G:\source\mushclient\WinDebug\MUSHclient.exe' has exited with code -1 (0xFFFFFFFF).

The final line is the important one, MUSHclient.exe has exited.

Now if I try slightly different syntax:

/world.Note ("hi");

I get these errors:

Use of undefined constant world - assumed 'world'
Call to undefined function Note()

However, MUSHclient does not exit and continues normally.

So I have two major problems - the first is that, although I am familiar with PHP, I don't seem to be able to get it to recognise the "world" object (using $world doesn't help much either).

The second is, that for certain sorts of errors the MUSHclient session goes away.

It seems that for parsing (syntax) errors like "syntax error, unexpected T_CONSTANT_ENCAPSED_STRING", it decides to terminate the application altogether, however for semantic errors (doesn't recognise the word "world") it doesn't. Sounds like a bug in the script engine to me.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #2 on Sun 26 Dec 2004 02:55 AM (UTC)
Just thought I'd let everyone know, I've just got prefix-style php scripting working.


For me it was a case of:
Copying the php5activescript.dll from http://snaps.php.net/ to the mush install directory.

Getting a very strage error about entry points when trying to register the dll.

Realising that I was running a version of php 1 minor out of date (5.0.2 instead of 5.0.3).

Installing that..

Searching around for all outdates copies of php5ts.dll (windir, windir\system, windir\system32, apache\bin.. etc.), delteing them, and replacing them with the new version.

And now, the register dll button worked! Hurray!

The I just had to hang MUSH a few times while trying to guess the syntax.

Just a note, taken (although I can't find the page again, so roughly remembered) from a FAQ somewhere:

. (periods) are not valid characters in variable names.
. (period) is the string concatenation operator.
Any unrecognised token becomes a string.


return a.b("sample argument");
-> return 'a'.'b'("sample argument");
-> return 'ab'("sample argument");
(not valid (arrays are [] delimited in php))


(assuming $a isn't null (=="somethingsomething")).

return $a.b("sample argument");
-> $a.='b'; return $a("sample argument");
~> return 'somethingsomethingb'("sample argument");

Hope this helps anyone else wanting to play, and I'll have a look at the actual script file soon.


Faux, from Discworld. Feel free to come talk to me =)

[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]