Callum Posted December 27, 2011 Posted December 27, 2011 Hey, We're trying to setup a dashboard for our server, using both MySQL and MTA. It is being written in PHP, and the MySQL part is all running fine. There is, however, a problem with hooking into the MTA server using the PHP SDK (latest version). Here is how we are hooking into MTA; http://pastebin.com/yVN5aS6Z The account has administrative rights, and the function is exported to http via meta.xml I have checked the lua script, and it is returning the correct details. However, when I try and echo the returned data on the PHP page, absolutely nothing is output. I've tried everything; $info, $info[0], $info[0][0], $info[0]["name"], foreach looping, everything. The server is using PHP 5.3.2 Are there any other obvious things I've forgotton, which may be causing this problem? Thanks, Callum
Jaysds1 Posted December 27, 2011 Posted December 27, 2011 is your MySQL setup on your computer or on a webserver?
Callum Posted December 27, 2011 Author Posted December 27, 2011 A dedicated server (so yes, a web server), which is the same machine that hosts the MTA server.
Orange Posted December 27, 2011 Posted December 27, 2011 Jaysds1, stop spamming. I bet that you don't know PHP. Callum: use var_dump
Callum Posted December 27, 2011 Author Posted December 27, 2011 Thanks for the reply, Orange. var_dump returns 'NULL'.
Orange Posted December 27, 2011 Posted December 27, 2011 1) Is display_errors enabled? 2) I use this one and it works: $mta = new mta( "127.0.0.1", 22005, "snip", "snip" ); $resource = $mta->getResource ( "internet" ); $returns = $resource->call ( "serverInfo" ); $returns = $returns[0]; Try debugging your LUA side. PHP seems to be ok
Jaysds1 Posted December 27, 2011 Posted December 27, 2011 Jaysds1, stop spamming. I bet that you don't know PHP. Orange, I'm still learning php, so don't judge me
Callum Posted December 27, 2011 Author Posted December 27, 2011 I've added a debug output on the getInfo lua function. It outputs, so MTA is supplying the information, the problem must be web-related.
Orange Posted December 27, 2011 Posted December 27, 2011 Jaysds1, stop spamming. I bet that you don't know PHP. Orange, I'm still learning php, so don't judge me Oh, your advices made me facepalm. I've added a debug output on the getInfo lua function. It outputs, so MTA is supplying the information, the problem must be web-related. Maybe try to analyse mta_sdk.php sourcecode and perform the query by yourself? (afair it was http://host:port/call/resource/function)
Callum Posted December 27, 2011 Author Posted December 27, 2011 I've found the problem; The PHP file (framework.php) connects to MTA, and all the other pages (index.php, etc) include framework.php and call the function echoBoxes(). Because it connected to MTA in the root of framework.php, the variables don't exist in the function. Quite a complex problem, but is there any solution or work around?
Orange Posted December 27, 2011 Posted December 27, 2011 That's why I use http://kohanaframework.org - no need of taking care of these freakin globals
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now