Windoze command line execution?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Windoze command line execution?

Post by Chris Corbyn »

Hi,

With Perl it's possible to execute console commands and play with the results.

Can PHP running on a windows platform do this? Also, what's all this stuff about "compiling" PHP? - how do you compile it and what's the advantage?

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://php.net/function.exec

it sure can ;)

Depending on the persons' meaning of compile, there's compiling to binary executable and there's compiling to php bytecode, such as with Zend's Encoder/Optimizer. Compiling to binary executable converts the entire script to machine code. PHP bytecode still has to run through php, but will run faster because less checking (a lot simpler checking) has to be done on each command. That's what I understand anyways.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

So are you saying that PHP can be compiled to binary much like Java or C can so that you can write programs which are not web based with it? I din't realise PHP was so diverse.... I always thought it was interpreted and nothing else.

Thanks for the exec() thing....

EDIT: Actually I can see one big advantage to binary compiling PHP scripts... If you suddenly move to a host which doesn't have PHP installed you can use binary versions in the CGI folder without the requirement for php.exe
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

only recently (sorta) has php been able to be compiled to an independant executable. The conversion I've seen thus far isn't spectacular or anything, but it's a start.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

some nice projects:
http://www.hypervisual.com/winbinder/
http://wapache.sourceforge.net/



php/java/.net languages all have the same:
they compile to an intermediate language for a virtual machine.
Those instructions are then executed by the virtual machine (compiled to machine code, usually using jit and executing the machine code.)

http://www.zend.com/store/products/zend ... erator.php
http://eaccelerator.net/HomeUk
Post Reply