Wednesday, January 26, 2011

Which hosting will let me execute my own EXE with PHP?

I have a task that PHP (or any server-side scripting language) isn't practical for. It involves a lot of file I/O, processing, etc. and it will execute a lot faster using the program I made in C instead of PHP.

Do any hosts allow you to upload your own EXE files and run them on the server using PHP's exec, shell_exec, etc. functions?

Do you need a dedicated server to do this?

Also, I don't know if Facebook's PHP HipHop is out yet, but I really don't want to use that.

  • You probably will need a dedicated server to do such a thing. Typically the exec function is disabled for obvious security reasons; a shared server would not want an executable such as yours eating tons of CPU time for everyone else.

    Perhaps look into cloud hosting, such as Amazon EC2? This way you could start up your own virtual private server and run your application in its ideal environment. Also since you said "EXE" I assume it's a Windows application, and you can indeed run a Windows environment on EC2, whereas most PHP hosts run Linux machines.

    From Ricket
  • Why don't you write a CGI script in C and compile it. You could then take advantage of the speed of a compiled script and still keep in a format that the host is comfortable with.

    Alexandre Jasmin : You could even make it a PHP extension or a webserver module if the overhead of `CreateProcess()` is too much for you.
  • Nearly Free Speech says that C/C++ is welcome: CGI Support. It's also a great service and very cheap -- even for shared hosting.

    If you want a dedicated virtual server, Slicehost, Rimu, and Linode are far cheaper than EC2 if scaling isn't a big issue for you.

  • You can consider getting a VPS hosting. They're cheaper than dedicated hosting and you pretty much can do whatever you want within your VM sandbox.

    From sybreon

0 comments:

Post a Comment