1. get zip at site:
http://www.bambalam.se/bamcompile/
2. unzip
navigate to its directory from cmd prompt.
3. start>run... 'cmd'
4. use the command "cd" to change directory:
ex: "cd Desktop\bamcompile"
5. Place PHP script to be compiled next to bamcompile.exe (same directory)
6. in the cmd prompt, at that directory, type:
ex: "bamcompile test.php"
variations:
"bamcompile -c test.php" gives compression.
-e:something.dll allows a DLL to be embedded
And a bit more.
There's a much easier way, from explorer.exe: simply click and drag the PHP file icon onto the bamcompile.exe icon.
1. Input from the user at a prompt. I've tried 'prompt' and it kinda works, but can't call that with PHP (just manually typing at the prompt), so doesn't do much.
You CAN get input if running from the dos cmd prompt, so you type filename.exe input1, then input1 is the value of $argv[1]. BUT... that's ONLY from the command prompt. If running by starting the exe independandly, you can't get that.
It's possible for me to deal with the cmd prompt, but I would like to generate something reasonably user friendly.
You can read from the shell by reading from 'php://stdin'. If you're looking for user-friendliness, though (especially on Windows, whose primary target group doesn't actually know what a command prompt is) your best bet is to write a GUI interface, perhaps using PHP-GTK.
2. I was trying to make an ftp uploading script. AND watch the filesize as it uploads. Well... I got both going. Problem is that it can only do a single process at a time. No big deal there. So just run two programs. However, if one uses exec('start watcher.exe'); then it just waits til that program is DONE before continuing in the first. It's like a mini branch, but not a new program.
Any suggestions here? Really trying to come up with something.
PHP's threading support is... well... non-existant, really. It's primarily designed for web scripting, and there just isn't a call for multi-threaded web applications.
Note: all functions like directory listings, include (even from the net), etc etc. work just fine. echo outputs to the cmd prompt as text. Html is worthless, so start thinking about php in a different way.
It's true that it's often possible to write an application in PHP, but PHP is still much too web-centric for serious application development; I suggest you check out Python if you're looking for something more suitable. This bamcompile application seems like a waste of time, overall; it doesn't really compile the code, it merely embeds it into an instance of the PHP interpreter. About its only worthwhile feature is the compression. There are no other significant advantages over simply providing the interpreter and a shortcut or minimal binary:
Code:
char *args[3];
int main(int argc, char **argv) {
args[0] = "php";
args[1] = "data/main.php";
args[2] = 0;
execv("interp/php.exe", args);
return 0;
}
This code assumes the directory structure is set up like so:
Code:
run.exe
data/
data/main.php
interp/
interp/php.exe
Bookmarks