What Happened to PHP?

in voilk •  4 months ago

    lamp.jpg

    There is a new tribe in town titled Learn2Code. This tribe will reward posts with the venerable BYTE token. The tribe also has a new Discord Server.

    The tribe invites posts about coding; So, I decided to write a series of posts about coding.

    A decade ago I wrote a series of articles about using PHP and MySQL to create dynamic web pages. My target audience was small businesses looking to add server side features to their web pages.

    At the time, it was common for webhosts to offer a collection of programs called the LAMP Stack. The Acronym LAMP referred to "Linux, Apache, MySQL and PHP."

    LAMP was the defacto standard for web development. NOTE: I asked Nightcafe to create a stack of antique lamps for this post.

    Everything seemed good.

    Sun Microsystems acquired MySQL in 2008. Everyone applauded.

    ORACLE acquired Sun Microsystems in 2010. ORACLE Corporation is noted for draconian licensing agreements for its database products and the Linux world panicked.

    Oracle began adding proprietary extensions to MySQL ... which is scary.

    Opensource aficionados created a fork of MySQL called MariaDB.

    I switched from using MySQL to SQLlite.

    Changes at PHP

    I advocated a functional design backed by a traditional relational database using the LAMP stack. This is the easiest way to create a dynamic web sites.

    PHP 3.0 had some obvious security holes. Free form PHP was prone to SQL injection and other hacks, etc.

    The functional approach reduces these vulnerability.

    Anyway, the programming world blew up in my face with the release of PHP 7.0. PHP had problems with the programs they published for accessing databases. PHP deprecated the functions and instructed the world to use the new PDO object to access the database.

    This is what happened to me:

    I copied an example of code using the PDO object.

    I ran it on my web server. I want to emphasize that the example that came from training material published in official PHP documentation.

    The example was something like:

    /******
    * Imagine table with three transactions 1, 2, and 3.
    * Three is the most recent transaction
    ******/
    
    $stmt = $pdo->query("SELECT trans_id, price FROM Transactions ORDER BY trans_id DESC");
    while ($row = $stmt->fetch()) {
      echo $row['name']."<br />\n";
    }
    

    There are three rows in the table. Row 3 has the most recent price. IMHO: It is the most important row.

    The PDO object only returned rows 1 and 2. It skipped the most important row!

    I admit. I am a traditionalist. I consider a function that returns the wrong value to be an abject failure.

    The whole point of a function is that a function returns a predictable value!

    Imagine that you were wanting to buy some BYTE on HIVE-Engine. Would you want to see price of the last transaction or would you want to see the price of the second to last transaction?

    The fact that the PDO object returned the wrong value was a category killer for me.

    I spent 6 months trying to figure out why PDO sometimes returned the wrong value.

    ZEND Berates PHP Developers

    What happened next was even worse.

    I filed a bug report and contacted Zend (the company that developed the program).

    I provided an example from their published materials. The example returned the wrong result.

    The programmers at ZEND immediately did what every second rate computer hack does.

    They launched into an attack and berated me.

    They attacked me for using an functional approach to web design. They attacked me for the naming convention I used for variables ... again, I was using variable names from official documentation.

    I was perplexed by the mistreatment. I then found out that the second rate hacks at Zend were berating anyone who had problems with their bug ridden code.

    It is a very simple case of projection. One blames others for their core faults.

    I can tolerate people mistreating me. I cannot tolerate systematic mistreatment of others.

    The Zend customer base was small businesses that were hanging on by a thread. Zend killed thousands of mom and pop web design businesses.

    The Cause of the Problem

    BTW: The problem that I faced was the result of the way that the PDO object extended the Countable Object.

    I have no clue as to why the PDO object would be extending the countable object.

    The Zend Framework

    As I understand, PHP was released under a slightly modified open source license. They disagreed with the "copyleft" principle that any code developed with PHP must also be open sourced.

    Businesses have to have a way of making money. I have no problem with taht.

    As I recall, Zend's approach was to extend PHP with a proprietary framework that included an IDE.

    They licensed the proprietary framework for a fee.

    I had no problems with that.

    The problem I had was that they berated people who did not use their stinking framework.

    At the time I advocated a functional framework as opposed to an object framework.

    Unfortunately, I felt that I could no longer support the platform.

    This was the second leg of the LAMP stack to falter.

    From Zend to Laminas

    People in the Linux Community balked against the proprietary extensions in the Zend Framework.

    In 2019, Zend transferred control of Zend Framework to the Linux Foundation. They changed the name to Laminas.

    Should I Return to PHP?

    I still love the core PHP. Small businesses can easily role out PHP web sites using the functional paradigm.

    I was burned out by Zend.

    I do not have an irrational hatred of frameworks or object-oriented programming. I simply believe in using the right framework for the right job.

    The Problem With Frameworks

    I've been going through PHP related web sites and YouTube Channels. Much of the thought about PHP is revolving around frameworks.

    The idea seems to be that one should chose a framework for their code, then code to that framework.

    The problem with this is that when one programs for a framework, one builds a dangerous dependency on the framework.

    PHP and HIVE

    I've followed programming posts on HIVE. Although PHP continues to be the best programming language for small business. There does not appear to be much interest in PHP on HIVE.

    HIVE developers tend to use node.js and python. I use Python for managing files. I am scared to use Python because I've seen people destroy files by mistakes in their Python code. While Javascript is great for integrating with the HTML DOM, I don't like using it for generating pages.

    People here prefer Node.JS or Python. Sadly, everything that I dislike about PHP is true of both of these frameworks.

    What Should I Write About For BYTE?

    I decided to write some articles for the new @learn2code tribe and I am having a bear of a time figuring out what to write.

    I am actually considering doing something extremely odd.

    I am considering creating a web site from the ground up in C.

    The articles will actually concentrate on core web technologies like the TCP/IP stack, network interface cards and the things that people discussed back in the 1990s.

    I really don't know if the articles will have any value. To be truthful, I cannot think of a single subject I can write about that would not be berated by someone.

    I notice that a whale has taken to downvoting the articles in the Learn2Code tribe. When did programming become such a toxic subject?

      Authors get paid when people like you upvote their post.
      If you enjoyed what you read here, create your account today and start earning FREE VOILK!