4

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?

3
  • The installation instructions don't seem all that different from Wordpress's. Download package, upload to host then configure application. Aug 6, 2011 at 15:48
  • 1
    @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, 2011 at 16:33
  • mod_python?????
    – Chris
    Aug 7, 2011 at 12:28

3 Answers 3

-1

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..)?

1
  • 1
    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, 2011 at 12:29
2

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).

1
  • 1
    +1 for more importantly, try it yourself.
    – Chris
    Aug 7, 2011 at 12:29
0

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.

3
  • Perhaps the question should have been "how can I run Python or Perl scripts outside the cgi-bin directory?"
    – Matty
    Aug 6, 2011 at 16:37
  • 2
    dynamically typed != interpreted. And most likely, if they have a LAMP stack, the machine came installed with Perl/Python by default.
    – jsternberg
    Aug 6, 2011 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. Aug 7, 2011 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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