PHP, which stands for Personal Home Page or PHP Hypertext Preprocessor, is a specialized scripting language designed for creating dynamic web content that is executed on the server side. It's also considered a reflective programming language used to execute scripts on the server side, although it can also be used with the command-line interface or through a standalone graphical application. It has always been an alternative to commercial programming languages like Java and others. Incredibly, PHP originated in 1994 as a set of CGI binary files in the C programming language, coded by Danish programmer Rasmus Ledorf to replace Perl scripts on his personal webpage. Officially, PHP made its appearance on June 8, 1995.
Behind it today stand The PHP Development Team, Zend Technologies, the PHP Foundation, and millions of users. It is estimated that over 76% of websites on the Internet are powered by PHP in some way. By default, PHP files end with the *.php extension. Sometimes, a portion of PHP code is embedded directly into HTML pages; together with HTML, but best practice is to separate PHP from HTML into a separate file. When the server encounters a PHP header <?php and code in PHP; or a file that ends with *.php; it automatically passes the entire file to the PHP processor. The result is that your web browser will only display HTML, while all PHP code remains hidden. If you take any HTML file and rename it to *.php, the HTML will be executed as if you were using *.htm or *.html. If you're coding in PHP, always use *.php files.
The first version of PHP was officially named Personal Home Page Tools; PHP Tools. It was simply the first use of the name PHP. Consider that the creator of PHP didn't initially intend for PHP to become a programming language. In the second version, Rasmus Ledorf claimed that PHP was the simplest and fastest tool for creating dynamic web pages. The third version of PHP completely changed the entire foundation from scratch. From all 4.x versions; the Zend Engine was added; which added a more advanced tag-parsing system - parse-execute, superglobals were introduced, register_globals was disabled by default, and CLI was introduced as an addition to CGI. Only from July 13, 2004, did the PHP version bring significant improvements, of which object-oriented programming support is definitely one. This opened up a whole new set of possibilities and a whole range of frameworks for PHP emerged; which we would translate as work frameworks like Laravel.
You see, the problem with PHP is that it's too simple. You can easily try out your ideas and admire the quick successful results. The problem is when your project gets bigger and your team gets more people. In PHP, you can do many things in multiple ways; what is simple for you can be completely complicated for others. Some things become obsolete, some are discarded, others change while each new phase becomes a nightmare. What is done in one day quickly turns into five days or you get completely stuck. For example, instead of the PHP header <?php, you type <php? and the entire project, the Internet, time, and deadlines will turn upside down. And you simply have no idea what's wrong with the errors. In the PHP programming language, there are so many mistakes; on some small details or logic that fixing errors can become a nightmare for every programmer.
And if you're entangled in classes, inheritance, interfaces, some project organization that only the first creator understands; documentation is useless then. That's why frameworks were created, and sometimes it's advisable to use them so that some things are organized for you. Again, if you're going to use shared hosting; then stick with pure PHP; because providers can disable e.g., routing on their server and then You're stuck or rent your own server, which will cost you three times as much. So, only experience saves you. And it's based on the mistakes you've gone through yourself; justified or not.
Preparing For the PHP Adventure: Setting Up Your PHP Programming Environment
If you're using an IDE like Visual Studio Code with a live server extension, you can quickly test your PHP code. But this isn't the best way to learn PHP or build real-world applications. We recommend a more traditional approach. That's why we have a few tips for you, which it's best to follow, but you don't have to. Especially if you're more experienced users and already have some other habits or use something more professional, for example for developing table relationships in databases. Different options are always available to you. By setting up a local development environment, you'll have more control over your project, and you'll be able to learn how PHP interacts with different components of the web server and database.
- Try using Ubuntu on a virtual machine or use an old laptop with the same OS because most providers offer hosting on Linux operating systems much cheaper, and many companies with smaller budgets use the same.
- Install XAMPP so you can use the Apache server, phpMyAdmin, and the MariaDB database management system supported by its derivative MySQL. The same tools are available to you as standard with almost every hosting provider.
- Install Visual Studio Code. This IDE - Integrated Development Environment, will shorten your debugging time by 90%. It's free and more commonly used in Serbia for coding in many programming languages than, for example, some text editors like Sublime Text, Vi, Atom, etc.
XAMPP is a free, open-source package that makes it easy to set up a local web server on your computer. It includes Apache, MySQL (or MariaDB), PHP, and phpMyAdmin. Depending on your operating system Windows, Linux, or macOS, it's essentially like installing WAMP or LAMP. XAMPP for Linux and macOS offers additional features like Perl and OpenLDAP. If you're using Ubuntu, here's a video tutorial on how to install it:
You don't need to switch to Linux to learn PHP. This tutorial can be followed on Windows as well, even though we'll be using Ubuntu. Your code will work on any operating system. You'll just need to install the equivalent tools for Windows, which is often simpler. Here's a video showing how to install XAMPP on Windows:
No comments:
Post a Comment