{"id":7870,"date":"2015-03-16T21:20:22","date_gmt":"2015-03-16T21:20:22","guid":{"rendered":"https:\/\/owncloud.com\/?p=7870"},"modified":"2015-03-16T21:20:22","modified_gmt":"2015-03-16T21:20:22","slug":"owncloud-and-php","status":"publish","type":"post","link":"https:\/\/owncloud.com\/de\/blogs\/owncloud-and-php\/","title":{"rendered":"ownCloud and PHP"},"content":{"rendered":"<p><a href=\"http:\/\/php.net\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-7983\" src=\"https:\/\/owncloud.com\/wp-content\/uploads\/2015\/03\/PHP-logo.png\" alt=\"PHP-logo\" width=\"200\" height=\"106\" \/><\/a>PHP, as a language, is at the heart of the web. In 2013 almost 40% of websites ran on PHP. Major sites such as Wikipedia and Facebook are built on it and numerous other sites are deployed on a PHP based framework like Drupal, WordPress or Joomla. ownCloud is built on PHP, and in a conversation with ownCloud founder Frank Karlitschek and ownCloud core developer Thomas M\u00fcller we discussed where PHP is today and how its simple design benefits ownCloud.<\/p>\n<h2>Ye Olde <span style=\"text-decoration: underline;\">d<\/span>ays<\/h2>\n<p>The web used to be static. Frank reminiscences about his first web development experiences in the 90\u2019s. Back then, \u201cinteractive on the web meant contact forms,\u201d done in perl. PHP has made the web more dynamic and by the end of the 90\u2019s, when PHP 3 was on stage, the language had become quite popular. The reason being that it was \u201cquick and efficient,\u201d as Frank points out. With perl you had this \u201cstrange divide\u201d between the static pages and the interactive pages which go through a different URL, \u201cthe cgi-bin directory.\u201d With PHP you could do a normal HMTL page and when you needed dynamic behavior you \u201cjust put it in and then it\u2019s done.\u201d This is still a strength of PHP&#8211; \u201ceverybody gets this concept in five minutes.\u201d<\/p>\n<p>Of course, \u201cnowadays, it has turned around.\u201d You usually don\u2019t use PHP within the HTML of websites, instead you might embed some HTML in an app written in PHP; while static HTML has died and is generated dynamically by code. Still, this embeddable quality of PHP lowers the barrier to newcomers.<a href=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/1\/1c\/Evolution-des-wissens.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-7987 size-full\" src=\"https:\/\/owncloud.com\/wp-content\/uploads\/2015\/03\/evolution-of-knowledge-wikipedia.png\" alt=\"evolution of knowledge wikipedia\" width=\"371\" height=\"140\" \/><\/a><\/p>\n<h3>Evolution and Reputation<\/h3>\n<p>Through its history PHP has evolved with the web, starting as a language integrating dynamic content in a page to becoming \u201ca proper language today,\u201d as Frank notes. Its reputation of being a hackish language (as Mailchimp <a href=\"https:\/\/blog.mailchimp.com\/ewww-you-use-php\/\" target=\"_blank\" rel=\"noopener noreferrer\">noted in a blog post<\/a>) hasn\u2019t gone away since then. Yet if you would learn it today, like Thomas did long after having worked with many other languages, you would conclude it is \u201cjust like every scripting language for the web.\u201d<\/p>\n<p>Thomas&#8216; first PHP code was written when he contributed to ownCloud and he notes that the language is \u201cnot without its quirks,\u201d but is capable of doing what has to be done and is quite forgiving at that. It was the bad reputation which had kept Thomas away from PHP, \u201cyou don\u2019t want to use something bad, so I never tried it\u201d, he notes. But he concludes that today, PHP is \u201cas capable as other web-oriented languages\u201d as well as their frameworks, tools, and libraries, and provides \u201cthe same power and efficiency\u201d as those others.<\/p>\n<p>Of course, there are still things to improve. Frank <a href=\"http:\/\/karlitschek.de\/2014\/10\/a-possible-future-for-php\/\" target=\"_blank\" rel=\"noopener noreferrer\">blogged about a possible future for PHP earlier<\/a> and he and Thomas have more thoughts on the subject. PHP has \u201csome inconsistencies in the naming of internal functions and classes variables,\u201d which could use a cleanup, however Frank thinks that it is \u201cnot a huge deal\u201d and certainly not unique to PHP. Another subject he brings up is security, stating that \u201cmany people consider PHP insecure.\u201d This reputation comes from \u201cdesign decisions in the past.\u201d This has been fixed by using the right frameworks and patterns, but \u201cthe reputation is still there.\u201d Frank thinks that it is still easy to write insecure PHP code, but Thomas disagrees on this, noting that there is is the \u201cproblem of comparing the language with a framework.\u201d Of course, \u201cpeople say, \u2018with Rails, this bug with PHP would never happen because it is handled in some framework layer.&#8217;\u201d That is \u201capples and peas;\u201d had the rails project used pure ruby, it would have run the same risk.<\/p>\n<p>Thomas concludes that he never saw the horrors that were ascribed to PHP, but rather that the language has \u201csome nice things\u201d about it.<a href=\"http:\/\/wikimedia.org\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-7989\" src=\"https:\/\/owncloud.com\/wp-content\/uploads\/2015\/03\/Disco_ball4.jpg\" alt=\"Disco_ball4\" width=\"200\" height=\"199\" \/><\/a><\/p>\n<h3>Where PHP Shines<\/h3>\n<p>Frank explains that PHP makes \u201csome things simple,\u201d which especially helps in big projects. For example, it does not run \u201cbackground stuff, no server like in Java.\u201d A request comes, a script executes, and the request is done, which brings an advantage in scalability. But this is not about performance in itself, as Frank points out, but about the question of \u201cif I double the hardware, do I have double the speed?\u201d PHP is built in a way where \u201cyou don\u2019t have a single big monster app server,\u201d so scalability is rarely a PHP question, but rather one of database, file system and user management.<\/p>\n<p>This simplicity also helps profiling, debugging, and \u201clearning how stuff works.\u201d Not a lot of people appreciate simplicity, Frank says. There are some things you would do \u201ctotally different\u201d in Java EE. Thomas makes a note about Java stating that \u201cthese guys really like complexity.\u201d For closed source or internal business driven development, a high entry barrier is \u201cnot a big problem,\u201d he says. \u201cThere is some investment until you bring somebody on track\u201d but that is \u201cacceptable.\u201d In an open source project, however, this does not work. People have \u201cmaybe two hours in the evening where they just want to hack something quickly.\u201d Indeed, \u201cnobody will dig into a complex build system for a week before they send their first patch,\u201d Frank agrees.<\/p>\n<p>Of course, complexity is often not without reason. Sometimes it helps to have complexity on the tooling side to ease the job later on. Thomas brings in SQL as an example. \u201cThe easy way is&#8211; write everything yourself;\u201d separate queries for each database as needed. This is how it is in ownCloud at the moment and it \u201cis easy; everybody can contribute.\u201d But the result is that you have to \u201ctest the code paths on every database.\u201d But by using some \u201cadvanced technologies like a query builder or object-relationship, OM tool,\u201d the test efforts could be reduced, however, the entry level will remain higher. This thus represents a \u201ctrade-off that we are facing.\u201d<\/p>\n<p>Frank always brings this up when \u201cwe have people who want to improve the framework with complex, sophisticated solutions.\u201d These solutions, of course, bring benefits but also \u201ccreate a barrier for new people.\u201d We have to be careful that we don\u2019t \u201ccreate a monster that nobody can maintain anymore;\u201d just one person. \u201cIt\u2019s not only about the architecture, it is also about the social aspects and the community momentum.\u201d Frank emphasizes that \u201cfun is so important because not everybody is paid to work on ownCloud.\u201d PHP isn\u2019t fun because of itself, but because \u201cit is easier to get into\u201d and because \u201ca lot of people know PHP\u201d and can provide resources online like tutorials or help. Last but not least, it is fun because \u201cmany interesting projects are built in PHP,\u201d as Thomas noted, including ownCloud of course!<\/p>\n<p>The many PHP projects means that there is a lot of PHP knowledge out there. Many developers are familiar with the language, many libraries are available offering API\u2019s to developers and are making it easy to integrate new functionality. However,not every library, connector, or module out there is perfect, but it usually beats having to write one yourself!<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignright size-thumbnail wp-image-7268\" src=\"https:\/\/owncloud.com\/wp-content\/uploads\/2014\/08\/stats1-150x150.png\" alt=\"stats\" width=\"150\" height=\"150\" \/><\/p>\n<h2>PHP and ownCloud<\/h2>\n<p>ownCloud, like many PHP projects, benefits from the ecosystem around PHP. The language might not be perfect, but it has come a long way and still has a huge momentum as well as significant advantages that make it a great choice for many projects. The low barrier to entry is certainly one of them, but in the end,what matters is that interesting technology is written, bringing real, tangible benefits to users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP, as a language, is at the heart of the web. In 2013 almost 40% of websites ran on PHP. Major sites such as Wikipedia and Facebook are built on it and numerous other sites are deployed on a PHP based framework like Drupal, WordPress or Joomla. ownCloud is built on PHP, and in a [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":78665,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"categories":[332,333,335,341,344],"tags":[],"class_list":["post-7870","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-community","category-development","category-news-from-owncloud","category-opensource"],"acf":[],"_links":{"self":[{"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/posts\/7870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/comments?post=7870"}],"version-history":[{"count":0,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/posts\/7870\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/media\/78665"}],"wp:attachment":[{"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/media?parent=7870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/categories?post=7870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/owncloud.com\/de\/wp-json\/wp\/v2\/tags?post=7870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}