PDA

View Full Version : Running mxmlc through PHP's exec() or similar


StarwoodCSG
12-29-2008, 05:08 PM
I've been searching and tinkering for a while to find a way to run mxmlc through PHP's exec() (or shell_exec() or system()...). I'm on OS 10.4, PHP5, flex3.

For the sake of just getting it to run, I've given execute permission to all users for mxmlc, and write permission to all users for the .swf destination directory. Nothing.

I can get an 'ls -l' of the directory for mxmlc through PHP. The permissions all show up with 'x'. Yet I still get an exec() return value of 1, (invalid function, no?). I can fwrite() a file to the destination directory too...

I'm very new to both Flex and using exec(). So, sorry if my description doesn't lend itself to a specific solution. Yet, in general, has anyone done this? Should I even bother to keep trying?

Thanks.

drkstr
12-29-2008, 09:39 PM
This isn't really a Flex issue. If you can you run a command in the shell you should be able to to run it with exec. Just make sure you give the absolute path to the binary or make sure it's in your PATH environment var. If that doesn't help, post in a PHP forum.


Best Regards,
~Aaron

StarwoodCSG
12-29-2008, 10:49 PM
Thanks Aaron. It may not exclusively be a Flex issue, but I've received bupkis from PHP forums and other sources. So, it seems like an issue some here may have encountered &/or surmounted.

Also, I would be happy to hear how anyone has managed to script the running of mxmlc by any means, so it's not exclusively a PHP question (sorry, wasn't clear about that before). I'm really just trying to get at mxmlc.

The command I'm trying through exec() does run just fine in the shell. I had been using absolute paths. I have made sure that the path to mxmlc is in my .profile. Still nothing.

Any further ideas, or just general experiences would be appreciated, although I guess I understand if the feeling is that it's too off-topic. I'll post in server side as well.

Thanks again.
-Dan

StarwoodCSG
12-30-2008, 03:08 PM
Ok, so I understand that the admins' feeling is that, despite this question being specifically about mxmlc, this is a server side question. To me, it kind of seems to straddle the divide, but that may be why I can't figure the issue out.

So, anyone ever been able to run the Flex 3 command line compiler (mxmlc) through any server side technology? I have a PHP bias, but any advice or means to that end is welcome.

OS10.4, flex3, php5 (safe mode is off). The mxmlc commands I'm using work in a terminal shell. I've tried both absolute paths and adding the binary's path to the PATH environment var in my .profile (which made terminal execution easier, but didn't make it any more possible to run through exec()). The permissions for everyone on the target .mxml are read, on the destination directory are read/write, and on the mxmlc binary are read/execute.

this:
mxmlc /Library/WebServer/Documents/flex/mxml/test.mxml

..gives me a return var of 127 through exec(), yet runs just fine in a shell. Alternately, regular commands like help, ls, chmod work just fine through exec().

I hope this is a clear enough picture of the situation, and again, I really appreciate any suggestions at all.

bitbitbit
02-02-2009, 02:38 PM
i have tried this script


shell_exec("mxmlc form.css");


and it converts form.css into form.swf, also you can try to work with backtick operator as


$output = `mxmlc form.css`;
echo $output;


Don't forget to add flex sdk bin directory in you enviorment path

StarwoodCSG
02-02-2009, 03:26 PM
Thanks for the suggestions bitbitbit. I'm curious if you're on a PC or Mac.

It has been a while, but I believe I had actually tried both backtick and shell_exec(). Regardless, I just tried them again. Still, nothing is being written.

The flex bin directory has been in my environment path for the vast majority of these attempts.

I've been forced to give up on this since December. This is as much because of funding issues for the project into which it would feed as it is because of how insoluble the task seems to be. I'd still really like to know what's going on, but I may not get the chance to look into it much more. Thanks though.