Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

PHP's deployment model is uber simple: upload and run. This is especially ideal for web applications that are intended to be installed on shared hosting by end users (think: Wordpress). Compare this with the installation of a popular Perl app.

I want to stop writing things in PHP, but want to keep the same deployment model. Is it possible to achieve this with Python or Perl in such a way that it'll work with most shared web hosts?

In other words, how can I run Python or Perl scripts outside of the cgi-bin directory on most shared hosts, like I can with PHP scripts?

share|improve this question
The installation instructions don't seem all that different from Wordpress's. Download package, upload to host then configure application. – unholysampler Aug 6 '11 at 15:48
@unholysampler While someone like you or I would undoubtedly have no problem installing MT, the average user is going to find it far more complicated and confusing than Wordpress' install. – Matty Aug 6 '11 at 16:33
mod_python????? – Chris Aug 7 '11 at 12:28
up vote -1 down vote accepted

PHP is easy to deploy, and I suspect that that is what made it popular. It is easy to deploy because it started out as an Apache module.

There's nothing, in principle, keeping Python, for instance, from being that easy to deploy. You could make a Python module for Apache that worked like PHP. Actually, I imagine someone must have done that already.

The question you should be asking is this: since the PHP model is so convenient, and since it could be made to work with any language, why doesn't every language work just like PHP? Is there a downside to it (other than having to program in PHP, which is a pretty big downside already..)?

share|improve this answer
Why stab at php like that. Why doesn't every language work like php? Because then we would have a bunch of php forks/clones. Downside, PHP has its purposes whether you agree or disagree/whether you like or dislike the language. – Chris Aug 7 '11 at 12:29

I can only speak about Python and I have never heavily done web development (just the "Hello, world" stuff with Apache and mod_python). I do have a lot of experience with Python in general.

Yes, it should be as simple. PHP, Perl, and Python are all typically interpreted languages. All that should be required is that the files are changed and a new instance of the interpreter has been started (as to load the new files).

Most importantly, try it yourself.

If the hosting site is already using a LAMP stack, I'll bet they have Perl and Python installed by default. Just try running their respective commands to see if they're installed (perl -v/python -V).

share|improve this answer
+1 for more importantly, try it yourself. – Chris Aug 7 '11 at 12:29

PHP, Perl and Python are all interpreted languages, which don't require that you compile your application before deploying it.

The installation of the Perl application is specific for the application, and is a configuration process. Had the application been ported to any other interpreted language, i.e: PHP, you'd still need to go through the configuration process.

You won't be able to deploy Perl and/or Python solutions as many places as you'd be able to deploy PHP solutions, this is because many hosting solutions only use simple LAMP stacks that only support the apache PHP module.

tldr: If your host supports the chosen interpreted language, your deployment has the potential of being as simple as write-upload-done.

share|improve this answer
Perhaps the question should have been "how can I run Python or Perl scripts outside the cgi-bin directory?" – Matty Aug 6 '11 at 16:37
dynamically typed != interpreted. And most likely, if they have a LAMP stack, the machine came installed with Perl/Python by default. – jsternberg Aug 6 '11 at 16:50
Dynamic typing has nothing to do with this. Python is compiled (to bytecode) before execution if you are using the CPython implementation. Perl is too, IIRC. Anyway, the type systems of these languages are not relevant here. – T Duncan Smith Aug 7 '11 at 2:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.