Calling fcsh from PHP script
My question is if Flex fcsh can be called from a PHP script. Here is the background:
I created a simple process that creates a simple test / tutorial by converting a text file to a .mxml file and compiling to a .swf file using the mxmlc compiler. This works well from the command line, but I wanted to make things easier by creating a web interface for it. My initial attempts with the PHP exec () function did not work. The Python scripts I am using to generate the .mxml file work fine (with exec ()), but I was unable to get the mxmlc compiler to work.
After searching the web and this site, I believe that using fcsh (instead of mxmlc) might be the way to go. Using fcsh will surely compile the .mxml file faster (after first start) and I think fcsh can be started as a service that can be called from PHP.
On the other hand, perhaps I am approaching this the wrong way. Wouldn't it be better to write a Flex application that calls fcsh and avoid using PHP?
Edit: Using fcshctl as a hasseg suggested in his answer below worked pretty well. Thanks Ali.
source to share
The problem with calling fcsh from within scripts is that it works like an interactive shell instead of accepting command line arguments, compiling and returning an exit status. There are different ways to get around this, which I have listed in this blog post where I mainly talk about fcshctl
(this is my own solution for this), but at the bottom of the post I have also listed other similar solutions to integrate fcsh into non-standard workflows assembly.
source to share
There are several other ways in php to execute an external script. These are exec (), passthru (), system () and backticks, that is, the key to the left of key 1. Each has a different purpose and return mechanism.
You may need to run the command that executes your executable in a script and call the script through one of these functions.
source to share
Is there a specific reason why you can't directly use mxmlc
? It looks like it would be easier to call than fcsh
. Just specify all your compiler options in the XML file, run it as mxmlc -load-config path/to/config.xml
. You can find an example of the XML configuration format in FLEX_HOME/frameworks/flex-config.xml
.
source to share