djr33
01-31-2007, 11:04 PM
Well, this thing is pretty awesome.
Obviously PHP isn't the best for desktop stuff anyway, but it's fun to play with and some functions make it very useful, like built in FTP setup, etc. Or even for an automatic webpage generating app, since that's it's usual function. Just save as a file, not raw output.
The basics: The program runs through dos. Windows only. (EXE.. duh.) Linux? I dunno... I don't think so.
To use:
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.
Anyway.... working great... fun stuff.
Note: Some functionality of exec() and system() commands in PHP to use the command prompt, like exec('start some.htm'); would pop a webpage up in the browser... like open the page.
For the experts here, two things REALLY frustrate me. I've tried a lot, but can't get either to work.
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.
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.
The only option I can see now is using a batch file to begin with. Using a batch file or an indirect route the many .bat/.exe's doesn't do anything once it's going. But the .bat file, (I think, from limited tests) can create two instances at once. But then they could only communicate JUST through writing to a text file or something. Ew. By starting it at a certain time, it can know to look for the most recently created file at THAT point... not just wait around until it thinks the other one is going.
Note: some of this also functions with the cmd prompt, but not when run as independant EXEs.
also, using the '-w' parameter which hides the windowed mode, or some such, appears to help in certain ways, but not to a fully workable solution.
So... play, and let me know if you can help with either of the problems.
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.
Obviously PHP isn't the best for desktop stuff anyway, but it's fun to play with and some functions make it very useful, like built in FTP setup, etc. Or even for an automatic webpage generating app, since that's it's usual function. Just save as a file, not raw output.
The basics: The program runs through dos. Windows only. (EXE.. duh.) Linux? I dunno... I don't think so.
To use:
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.
Anyway.... working great... fun stuff.
Note: Some functionality of exec() and system() commands in PHP to use the command prompt, like exec('start some.htm'); would pop a webpage up in the browser... like open the page.
For the experts here, two things REALLY frustrate me. I've tried a lot, but can't get either to work.
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.
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.
The only option I can see now is using a batch file to begin with. Using a batch file or an indirect route the many .bat/.exe's doesn't do anything once it's going. But the .bat file, (I think, from limited tests) can create two instances at once. But then they could only communicate JUST through writing to a text file or something. Ew. By starting it at a certain time, it can know to look for the most recently created file at THAT point... not just wait around until it thinks the other one is going.
Note: some of this also functions with the cmd prompt, but not when run as independant EXEs.
also, using the '-w' parameter which hides the windowed mode, or some such, appears to help in certain ways, but not to a fully workable solution.
So... play, and let me know if you can help with either of the problems.
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.