Python vs PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Catalin

    Python vs PHP

    Can Python replace PHP?
    Can I use a python program to make an interface to a mysql 4.X database?
    If that's possible where can I find a tutorial?


  • News M Claveau /Hamster-P

    #2
    Re: Python vs PHP

    Hi !

    PHP-5 let down MySql, for Sql-Lite (rumor ?)

    Python has good support for MySql AND Sql-Lite.

    @+

    Michel Claveau


    Comment

    • Aahz

      #3
      Re: Python vs PHP

      In article <mailman.105757 4470.1750.pytho n-list@python.org >,
      Catalin <ady982@ploiest i.astral.ro> wrote:[color=blue]
      >
      >Can Python replace PHP?
      >Can I use a python program to make an interface to a mysql 4.X database?[/color]

      The short answer is "yes" to both questions, but with a caveat: Python is
      a general-purpose programming language, where PHP is designed to write
      web applications. So it's not quite as simple/straightforward to use
      Python the same way you use PHP for plain web pages; conversely, if
      you've been running into difficulty with PHP in trying to write
      complicated program logic, you'll find Python a big help.
      --
      Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

      "Not everything in life has a clue in front of it...." --JMS

      Comment

      • Bruno Desthuilliers

        #4
        Re: Python vs PHP

        News M Claveau /Hamster-P wrote:[color=blue]
        > Hi !
        >
        > PHP-5 let down MySql, for Sql-Lite (rumor ?)[/color]

        PHP 5 won't come bundled with a default MySql lib, but anyone is still
        free to link against the official MySQL lib, one way or another...

        And yes, the default 'bundled-in' SQL lib should be Sql-lite.

        Bruno

        Comment

        • Jaroslaw Zabiello

          #5
          Re: Python vs PHP

          On Mon, 07 Jul 2003 13:47:00 +0300, Catalin
          <ady982@ploiest i.astral.ro> wrote:
          [color=blue]
          >Can Python replace PHP?[/color]

          Sure. Look at http://spyce.sourceforge.net
          [color=blue]
          >Can I use a python program to make an interface to a mysql 4.X database?[/color]

          Of course, you can. http://www.python.org/sigs/db-sig/
          E.g. http://dustman.net/andy/python/MySQLdb_obsolete
          [color=blue]
          >If that's possible where can I find a tutorial?[/color]
          The official home of the Python Programming Language

          The official home of the Python Programming Language

          The official home of the Python Programming Language


          --
          JZ


          Comment

          • Jp Calderone

            #6
            Re: Python vs PHP

            On Tue, Jul 08, 2003 at 11:14:10AM +0200, Jaroslaw Zabiello wrote:[color=blue]
            > On Mon, 07 Jul 2003 13:47:00 +0300, Catalin
            > <ady982@ploiest i.astral.ro> wrote:
            >[color=green]
            > >Can Python replace PHP?[/color]
            >
            > Sure. Look at http://spyce.sourceforge.net
            >[/color]

            Lest the OP think Spyce is the only or even the preferred solution for web
            programming with Python:







            Download Webware for Python for free. The Classic Webware for Python. Webware for Python is a suite of components for dynamic, server-side web development.








            Simple yet powerful multi-threaded object-oriented CGI/FastCGI/mod_python/html-templating modules for Python.




            And let's not forget plain old CGI and mod_python.

            Jp

            --
            "There is no reason for any individual to have a computer in their
            home."
            -- Ken Olson, President of DEC, World Future Society
            Convention, 1977

            Comment

            • Afanasiy

              #7
              Re: Python vs PHP

              On Mon, 07 Jul 2003 13:47:00 +0300, Catalin <ady982@ploiest i.astral.ro>
              wrote:
              [color=blue]
              >Can Python replace PHP?
              >Can I use a python program to make an interface to a mysql 4.X database?
              >If that's possible where can I find a tutorial?
              >[/color]

              I recommend Spyce, Webware, or Quixote depending on your requirements,
              but Draco, SkunkWeb, RoadKill are worth looking into as well. Spyce is
              really the best (for PHP-ness) in my opinion, after you actually get past
              the fact that it supports your old fashioned notion of what embedded
              delimiters should look like, as well as a new CTS-friendly alternative.

              Spyce is the closest thing to PHP, but also provides some features PHP
              does not. However, I think you will find some people, like myself, who are
              still unable to make the switch from PHP to Python for web development,
              because of a lot of little things. These people know Python is better and
              may even know their non-web PHP applications are hell compared to their
              Python re-implementations . However, they still use PHP for web development
              and feel they have to. They may have even written out all the requirements
              and received vague responses to them.

              Python web development is fragmented. Mod_python CVS now contains the work
              of what used to be mod_psp by Sterling Hughes, a PHP warlord, I'm sure
              he'll reply. This possibly soon to be official 'PSP' is not much in my
              opinion and should probably not be folded into mod_python. Others agree:



              Another big problem with Python web development is the lack of good shared
              hosting support. Primarily the lack of anything resembling PHP's safe
              mode. Mod_python has no equivalent of this safe mode, but Apache 2's
              'Perchild MPM' is supposed deprecates this need. However, this still
              requires an httpd.conf edit and a restart of Apache for every user added,
              very annoying, especially to a shared hosting service.

              semanticgap writes "The beauty of Python at Apache speeds! A couple of months after donation to ASF, a new mod_python is out under the Apache license. Main feature of this release is Apache 2.0 compatibility, including support for filters and connection handlers and many more enhancements. More in...




              A couple other slight issues :

              * catch-all error handling not as flexible or non-existent
              * no equivalent to php_value auto_prepend_fi le "_header.ph p"
              * no equivalent to php_value auto_append_fil e "_footer.ph p"
              * not as intelligent form value handling
              * white space sensitivity is a unique problem when embedding

              The best options for me are currently :

              * use PHP
              * use Spyce
              * fork Spyce (creating more fragmentation)
              * embed python straight into my favorite platform (quite funny)
              * write my own mod_python-based platform (more fragmentation)
              * find the holy grail (i must have missed it)

              I've been handling this dilemma for months. I've even benchmarked quite a
              few possible solutions, with pleasing results in those which I thought
              were well done, and pleasing results for Python over PHP in general.

              -AB

              Comment

              • Jon Ribbens

                #8
                Re: Python vs PHP

                In article <kmolgv4mp12o71 ocion7ra0m2s9fc rqjdk@4ax.com>, Afanasiy wrote:[color=blue]
                > A couple other slight issues :
                >
                > * catch-all error handling not as flexible or non-existent
                > * no equivalent to php_value auto_prepend_fi le "_header.ph p"
                > * no equivalent to php_value auto_append_fil e "_footer.ph p"
                > * not as intelligent form value handling
                > * white space sensitivity is a unique problem when embedding[/color]

                Try jonpy (http://jonpy.sf.net/), it solves all of the above.
                Also you may find FastCGI (which jonpy supports) helps with your
                "safe mode" problem, although it might require a bit of hackery.

                Comment

                • Afanasiy

                  #9
                  Re: Python vs PHP

                  On Tue, 08 Jul 2003 15:56:58 GMT, Afanasiy <abelikov72@hot mail.com> wrote:
                  [color=blue]
                  >On Mon, 07 Jul 2003 13:47:00 +0300, Catalin <ady982@ploiest i.astral.ro>
                  >wrote:[/color]
                  [color=blue]
                  >A couple other slight issues :
                  >
                  >* catch-all error handling not as flexible or non-existent
                  >* no equivalent to php_value auto_prepend_fi le "_header.ph p"
                  >* no equivalent to php_value auto_append_fil e "_footer.ph p"
                  >* not as intelligent form value handling
                  >* white space sensitivity is a unique problem when embedding[/color]

                  I think I should add import, pythonpath and module caching to this list.
                  These are much more annoying than PHP's inclusion mechanisms. I am even
                  annoyed in non-web applications by them quite often, but not necessarily
                  all at the same time.

                  Also add to the list, the need for PyChecker. You must run PyChecker
                  to discover errors which would occur on a section of logic being hit
                  which contained a silly typographical error. PHP would discover these
                  without them being hit, when you were developing the page.

                  Python is more beautiful and more powerful, but for this purpose I
                  consider the current implementations still lacking compared to PHP.
                  So much so that I am unable to bring myself to write new PHP, but
                  unable to continue using Python until I find the perfect implementation.

                  -AB

                  Comment

                  • Afanasiy

                    #10
                    Re: Python vs PHP

                    On 8 Jul 2003 16:02:48 GMT, Jon Ribbens <jon+usenet@une quivocal.co.uk>
                    wrote:
                    [color=blue]
                    >In article <kmolgv4mp12o71 ocion7ra0m2s9fc rqjdk@4ax.com>, Afanasiy wrote:[color=green]
                    >> A couple other slight issues :
                    >>
                    >> * catch-all error handling not as flexible or non-existent
                    >> * no equivalent to php_value auto_prepend_fi le "_header.ph p"
                    >> * no equivalent to php_value auto_append_fil e "_footer.ph p"
                    >> * not as intelligent form value handling
                    >> * white space sensitivity is a unique problem when embedding[/color]
                    >
                    >Try jonpy (http://jonpy.sf.net/), it solves all of the above.
                    >Also you may find FastCGI (which jonpy supports) helps with your
                    >"safe mode" problem, although it might require a bit of hackery.[/color]

                    No, CGI is not an option and I tried jonpy. I kept my notes about it...

                    Comment

                    • Jon Ribbens

                      #11
                      Re: Python vs PHP

                      In article <moulgv8ehi6680 j6to1ai6tlmopm0 srons@4ax.com>, Afanasiy wrote:[color=blue]
                      > CGI, FastCGI, SCGI are not faster than mod_python in my experience and
                      > straightforward benchmark.[/color]

                      In the case of CGI, yes of course. In the case of FastCGI, your
                      experience contradicts my own.
                      [color=blue]
                      > That's all I can really say about it. CGI is not an option for me.[/color]

                      I don't understand why you keep saying "CGI is not an option" when
                      nobody has suggested that you use it.

                      Comment

                      • Afanasiy

                        #12
                        Re: Python vs PHP

                        On 8 Jul 2003 17:59:12 GMT, Jon Ribbens <jon+usenet@une quivocal.co.uk>
                        wrote:

                        [color=blue]
                        >I don't understand why you keep saying "CGI is not an option" when
                        >nobody has suggested that you use it.[/color]

                        Ok

                        Comment

                        • A.M. Kuchling

                          #13
                          Re: Python vs PHP

                          On 8 Jul 2003 17:59:12 GMT,
                          Jon Ribbens <jon+usenet@une quivocal.co.uk> wrote:[color=blue]
                          > I don't understand why you keep saying "CGI is not an option" when
                          > nobody has suggested that you use it.[/color]

                          Jon, there's no point in debating Afanasiy about CGI. He's convinced
                          packages for Python web programming support are inadequate (*all* of them),
                          is unable to explain what the problem is or what his requirements are, and
                          doesn't seem to really understand the subject (e.g. thinking FastCGI is
                          basically the same as regular CGI). Ignoring him is the best course.

                          --amk

                          Comment

                          • Afanasiy

                            #14
                            Re: Python vs PHP

                            On Tue, 08 Jul 2003 20:46:53 -0500, "A.M. Kuchling" <amk@amk.ca> wrote:
                            [color=blue]
                            >On 8 Jul 2003 17:59:12 GMT,
                            > Jon Ribbens <jon+usenet@une quivocal.co.uk> wrote:[color=green]
                            >> I don't understand why you keep saying "CGI is not an option" when
                            >> nobody has suggested that you use it.[/color]
                            >
                            >Jon, there's no point in debating Afanasiy about CGI. He's convinced
                            >packages for Python web programming support are inadequate (*all* of them),
                            >is unable to explain what the problem is or what his requirements are, and
                            >doesn't seem to really understand the subject (e.g. thinking FastCGI is
                            >basically the same as regular CGI). Ignoring him is the best course.[/color]

                            Read.

                            Comment

                            • Jon Ribbens

                              #15
                              Re: Python vs PHP

                              In article <K6GcnTvaKdGQ6Z aiRTvUqA@speake asy.net>, A.M. Kuchling wrote:[color=blue]
                              > Jon, there's no point in debating Afanasiy about CGI. He's convinced
                              > packages for Python web programming support are inadequate (*all* of them),
                              > is unable to explain what the problem is or what his requirements are, and
                              > doesn't seem to really understand the subject (e.g. thinking FastCGI is
                              > basically the same as regular CGI). Ignoring him is the best course.[/color]

                              Oh, ok, ta ;-)

                              Comment

                              Working...