News for hackers. Stuff that matters.
Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Monday December 16, 2013 @10:51PM (#6919524)
Any of the myriad of good languages available out there? Php is only easy to install because it comes pre-installed in most low-end servers out there. Without that fact, php is just as cumbersome to get started as any other language.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Monday December 16, 2013 @11:09PM (#6919582)
"Php is only easy to install because it comes pre-installed in most low-end servers out there. Without that fact, php is just as cumbersome to get started as any other language."

It comes installed because it is easy to install. Someone had to install it and PHP is sure easy for any SysAdmin to get installed. It is easy to start because the PHP folks made it easy to get started.

Look at the steps to get PHP installed versus other languages. Then look at what "Hello World" and a simple form take.

Re:PHP functions originally bucketed by strlen, were renamed... by fuzzix on Tuesday December 17, 2013 @03:19AM (#6920097)
> "Look at the steps to get PHP installed versus other languages"

Not much different to getting CGI working. If you need it working well, FastCGI is as much effort as PHP-fpm. SUexec is as much effort as SUPHP.

Any language could supplant PHP in terms of ease of deployment, there's little out there that doesn't have some CGI library to handle the mucky parts.

Not that I am advocating use of CGI for anything non-trivial.

Re:PHP functions originally bucketed by strlen, were renamed... by weland on Tuesday December 17, 2013 @03:43AM (#6920149)
> Look at the steps to get PHP installed versus other languages. Then look at what "Hello World" and a simple form take.

That's really just not true. Installing anything capable of CGI is as easy to install as PHP.

Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @08:22AM (#6920944)
It seems many hosting companies or their sysadmins don't agree since PHP gets installed and Ruby, etc. doesn't. PHP is an easy to install module and very easy to do the first program since its just a part of the webpage.

If you want your favorite language to replace PHP, then you have to make it easy for the sysadmin to install (preferably 1 line) and for new programmers to be able to use the language by just uploading a file.

Re:PHP functions originally bucketed by strlen, were renamed... by jmccree on Tuesday December 17, 2013 @10:55AM (#6921756)
Yeah, but PHP use as CGI was likely never more than 1% of the market. What most people mean is installing mod_php is easier than setting up another language via cgi or fastcgi.
Re:PHP functions originally bucketed by strlen, were renamed... by bch on Monday December 16, 2013 @11:46PM (#6919670)
> just as cumbersome to get started as any other language.

Any other language that has dedicated .INI files to determine its behaviour, maybe. PHP caught on because of "Hello world" in a web browser, and smart people didn't realize the value of novelty.

Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:36PM (#6919644)

    sudo apt-get install apache2 php5 libapache2-mod-php5
Boom, I just installed PHP5 on Apache on Ubuntu, now I just upload a file to my project root.

Let me know when you find any way easier than that.

Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @12:09AM (#6919702)
Meanwhile, Python comes already installed by default in most linux distributions. So, forget .ini files, forget apache until deployment time(hell, don't be forced onto apache if you don't want to. Choose whichever deployment server you want. I know... options... it's weird... you'll get used to it), forget worrying about php upgrades on shared machines, forget that apt-get line. .py file, and you're up and running (and headache-less).
Re:PHP functions originally bucketed by strlen, were renamed... by emilv on Tuesday December 17, 2013 @01:40AM (#6919888)
I have a fresh install of such a distro, where Python is included. What do I need to do to from Python present an input form which takes my name and a second page that greets me using the same name? Including deployment of course, how else should I test it without paying a web host?

I'm not discussing headaches, I do nit particularly like PHP. My point is just that Python is not very easy to get started with for beginners.

Re:PHP functions originally bucketed by strlen, were renamed... by Shish2k on Tuesday December 17, 2013 @04:19AM (#6920232)

  import web
          
  urls = (
      '/(.*)', 'hello'
  )
  app = web.application(urls, globals())
  
  class hello:        
      def GET(self, name):
          if name: 
              return 'Hello, ' + name + '!'
          else:
              return "<form><input name='name'></form>"
  
  if __name__ == "__main__":
      app.run()
upload into your web server's cgi-bin folder, or have the server configured to exec all *.py files as python

ED> yeah, this is a few more lines of code than PHP and it requires a teeny tiny amount of knowledge about how the web works - and that "takes 5 minutes to get started" vs PHP's "takes 2 minutes to get started" is a big difference for someone who doesn't know what they're doing but wants results immediately :P

EDED> Actually now that I think about it, that's how /I'd/ start a simple webapp as it has the structure in place to grow easily and elegantly -- if you're willing to do things the quick and dirty way, you can go without a framework and just print an HTTP response to stdout - in which case the only difference with PHP is that the python version requires "print 'Content-type: text/html\n'" at the top

Re:PHP functions originally bucketed by strlen, were renamed... by emilv on Tuesday December 17, 2013 @05:38AM (#6920420)
I certainly do agree that this somewhat more abstract approach is much better for stable web applications. My point is that PHP doesn't require you to understand anything to get started, which explains its widespread usage. That is of course not true if you want security or maintainability, but that is exactly the snake oil sold by PHP.

But this web framework is much newer than PHP, isn't it? And this does not look better or easier than PHP: https://wiki.python.org/moin/CgiScripts

Re:PHP functions originally bucketed by strlen, were renamed... by Shish2k on Tuesday December 17, 2013 @06:46AM (#6920605)
> And this does not look better or easier than PHP: https://wiki.python.org/moin/CgiScripts

That has tracebacks on error and HTML escaping, so I'd say it's considerably better for a tiny increase in difficulty (but you're right that no matter now tiny the difference, PHP is still easier)

Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @01:06AM (#6919812)
I think your missing the point, what comes in a Linux distribution is irrelevant. What comes installed from a hosting company is what matters, and since PHP is easy for a SysAdmin to install it was installed. Choice is often limited by the host.
Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @11:29AM (#6921972)
Most hosts out there offer linux as their main platform? Plus, installing python with apt-get is not much more difficult than php. One liner, minus the .ini configuration stuff.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @04:43PM (#6924165)
"apt-get is not much more difficult than php"

Nope, I install PHP and then upload a page with PHP embedded and it works. It is not that easy with python. That's why all these hosting accounts had LAMP and not something else.

Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @09:53PM (#6925610)
What happened to context? The guy above me clearly said he used apt-get to install php. You're gonna have to install php somehow, whether you're gonna use apt-get or not is your decision, but whichever way you choose, apt-get or make, the difficulty is about the same.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @10:24PM (#6925705)
The difficulty isn't the same because installing python doesn't install any web server integration. That's the point.
Re:PHP functions originally bucketed by strlen, were renamed... by jtreminio on Monday December 16, 2013 @11:40PM (#6919652)

    php5
installs apache, by default.
Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:46PM (#6919669)
Good to know, I haven't used Apache in a while. I normally use Nginx, but that's not quite as easy to get up and running because you got to set PHP5-FPM sockets in your virtual host. ;)
Re:PHP functions originally bucketed by strlen, were renamed... by bhauer on Tuesday December 17, 2013 @12:47AM (#6919780)
There's the rub, really. I have been fascinated by how quickly the "it's so easy to install" mantra is replaced with "only a noob would use those settings, let me link you to a detailed guide on how you should really use PHP," at which point it becomes more complicated to install than alternatives.

I am not a fan, so I am biased. But I've never quite seen the appeal of such a superficial attribute as "it's already on my cheap server." Are we not programmers? How hard is it, really, to install a JVM, Python, Ruby, Go, or any other platform? It's never taken me more than scarce minutes. To my mind, it seems widespread delirium prioritizing such a non-priority over peace of mind and performance. It's akin to selecting an operating system based on the fonts it ships with.

Re:PHP functions originally bucketed by strlen, were renamed... by jarek on Tuesday December 17, 2013 @01:33AM (#6919876)
> But I've never quite seen the appeal of such a superficial attribute as "it's already on my cheap server." Are we not programmers?

Most people who start out programming PHP aren't programmers. (I think that's a good thing FWIW.) The ease to non-programmers explains the wide spread which is what the discussion is about.

Re:PHP functions originally bucketed by strlen, were renamed... by trentmb on Tuesday December 17, 2013 @02:54AM (#6920046)
./golang_app.bin