PHP (hyper text Preprocessor) is a computer scripting language. Designed for producing dynamic web pages, with syntax from C, Java and Perl, PHP code is embedded within HTML pages for server side execution it has evolved to include a command line interface capability and can be used in standalone graphical applications. PHP was originally created by Rasmus Lerdorf in 1995; the main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification. Released under the PHP License, the Free Software Foundation considers it to be free software. PHP is a widely used general-purpose scripting language that is especially suited for web development, taking PHP code as its input and creating web pages as output.
It can be deployed on most web servers and on almost every operating system and platform free of charge. From this you can create more complex loops and functions to make your page generate more specialized data. PHP is installed on more than 25 million websites and 1 million web servers.
1. What is a PHP File?
Ans: PHP files may contain text, HTML tags and scripts.
PHP files are returned to the browser as plain HTML.
PHP files have a file extension of “.php”, “.php3”, or “.phtml”.
2.How to install PHP on Apache?
Ans:You need to add the following lines to httpd.conf (If you’re using Apache for Win32).
ScriptAlias /php/” c:/path-to-php-dir/”
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php.exe”
Then restart Apache and it should interpret php files correctly.
3. Why PHP?
Ans: PHP runs on different platforms (Windows, Linux, Unix, etc.).
PHP is compatible with almost all servers used today (Apache, IIS, etc.).
PHP is FREE to download from the official PHP resource: www.php.net.
PHP is easy to learn and runs efficiently on the server side.
4. How does PHP compare to ASP?
Ans: Microsoft’s Active Server Pages (ASP) comes with VBScript and JScript scripting languages, but you can also install scripting engines for Perl, REXX, and Python, whereas PHP will only ever be PHP. The most commonly used flavour of ASP is that written in VBScript. VBScript is a subset of Visual Basic, a standalone compiled language. This very fact makes ASP marketable to VB programmers wishing to build applications for the Internet. However, as a script language VBScript could never compete with its big brother, Visual Basic, only supplement it. In making this point, VBScript is not solely a glue to hold Visual Basic together with an Internet front-end, but that’s really what it does best.
ASP can prove to be very memory hungry beasts and regular calls on system objects, such as Active Data Objects (ADO) for working with databases can make for slow applications on heavily loaded machines. VBScript lacks many important features, which can be added through Component Object Model (COM) objects. An example of this, is when trying to send e-mail using VBScript, although the objects are available, they can be costly and more time consuming than the PHP equivalent (mail function). PHP can also be ‘added to’ with additional functionality being quite platform dependant. COM functions are supported by the Windows version of PHP and many libraries are available for *nix versions.
VBScript interpreters are available for various Unix based systems and Windows. However, finding a COM object that will send e-mail on a Unix system is nearly impossible and very expensive. This leads to the conclusion that ASP is only really at home in a Microsoft environment. It has its fair share of security flaws, but when used by professional VB programmers, I have seen ASP provide some immensely powerful interfaces. PHP on the other hand can be seen to provide the best results in the form of stability and speed on Unix based systems.
PHP is Open Source software, which is great as it means that code, manual, updates and support are all free. Although the ASP script engine comes included with IIS and PWS and minimal support is available free, running Microsoft operating systems at a commercial level is always going to be costly.
A lack of high profile sites using PHP makes it a bit harder to prove it’s robustness and gain acceptance from non-programming colleagues (e.g. management), but for a programmer the portability and stability of PHP is beneficial.
5 What is caching?
Ans: “Meta tags are easy to use, but aren’t very effective. That’s because they’re usually only honored by browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document).”
If a page is changed “nearly every day”, it will hardly be a problem in practical terms. And in any case, it’s something to be handled at the server level, by making the server send some useful expiration information, using whatever needs to be done on a specific server. Telling that a page expired twenty years ago is hardly a good idea if you can expect its lifetime to be a day or more, or at least several hours. Defeating proxy caching brutally wouldn’t be a good idea (and meta tags won’t do that, so the errors in a sense cancel out each other, so to say This has to be at the beginning of the file, with nothing before (e.g. no blank). This is a brute force variation, some adjustments are useful. (Server supporting PHP is recommended)Meta-tags wont work with proxies. Proxies don’t work on the ‘HTML-layer’ but HTTP. Things depend on proxy settings also.”The Pragma header is generally ineffective because its meaning is not standardized and few caches honor it. Using <meta http-equiv=…> elements in HTML documents is also generally ineffective; some browsers may honor such markup, but other caches ignore it completely.” – Web Design Group That’s because the no-cache pragma is supposed to be part of a HTTP *request*. And *this* has been standardized since way back.