Introduction to PHP
Introduction to PHP
PHP: Stands for Hypertext Preprocessor.
It’s one of the world's most popular server-side scripting languages for building dynamic, data-driven Web applications and can be embedded into HTML.
Conversely, compiled languages such as C and C++ can be used to write stand-alone applications that can act independently of any event. You should also understand that PHP is a server-side technology. This refers to the fact that everything PHP does occur on the server (as opposed to on the client, which is the computer being used by the person viewing the Web site).
A server is just a computer set up to provide the pages you see when you go to a Web address with your browser (for example, Firefox, Microsoft Internet Explorer, or Safari).
Finally, PHP is cross-platform, meaning that it can be used on machines running Unix, Windows, Macintosh, and other operating systems.
Again, we’re talking about the server’s operating system, not the client’s. Not only can PHP run on almost any operating system, but, unlike many other programming languages, it enables you to switch your work from one platform to another with few or no modifications.
In this tutorial, we describe the basics of PHP scripts and the rules that apply to all PHP statements. Consider these rules similar to general grammar and punctuation rules. In the remaining tutorial, you find out about specific PHP statements and features and how to write PHP scripts to perform specific tasks
- PHP is much easier to learn and use.
- PHP was written specifically for dynamic Web page creation.
- PHP is both free and cross-platform.
- PHP is the most popular tool available for developing dynamic Web sites.
- PHP you are not limited to output by HTML but include other outputting methods like images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content.
- One of the strongest and most significant features of PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple by using one of the database-specific extensions (e.g., MySQL), using an abstraction layer like PDO, or connecting to any database supporting the Open Database Connection standard via the ODBC extension. Other databases may utilize cURL or sockets, like CouchDB.
- PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows), and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection.
- PHP has support for the instantiation of Java objects and using them transparently as PHP objects.
- PHP has useful text processing features, which include Perl-compatible regular expressions (PCRE), and many extensions and tools to parse and access XML documents.
- PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris, and OpenBSD), Microsoft Windows, macOS, RISC OS, and probably others.
- PHP also has support for most of the web servers today. This includes Apache, IIS, and many others. And this includes any web server that can utilize the FastCGI PHP binary, like lighttpd and nginx. PHP works as either a module or as a CGI processor. So, with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object-oriented programming (OOP) or a mixture of them both.
The PHP program works with the web server, which is the program that delivers web pages to the world. After you type a URL into your web browser’s address bar, you’re sending a message to the internet server at that URL, inquiring it to send you an HTML file. The web server responds by sending the asked file. Your browser reads the HTML file and shows the web page. You to ask for a file from the web server when you click a link on a web page. In addition, the web server forms a file when you click a web page button that submits a form. This handle is basically the same when PHP is installed. You request a file, the web server happens to be running PHP, and it sends HTML back to the browser, much obliged to the programming in PHP.
What can PHP do?
PHP scripts are used in three main areas.
Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work: the PHP parser (CGI or server module), a web server, and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming.
Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks
Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution.
Leave a comment
No Cmomments yet