When it comes to web development these days, you have many options. Many of these methods involve preprocessing—that is, embedding code into HTML pages using specific tags that tell the preprocessor that they contain code and that it should be processed. Much like CGI, these codes run on the server and return some content that appears as part of the resulting HTML page that is sent back to the browser. The open source scripting language PHP and the languages in Microsoft's ASP.NET framework fall into this category; JavaServer Pages (JSP) and Perl/Mason also operate this way.
In this article, I’ll focus on PHP — the technology Oracle has chosen to incorporate into its products — and ASP.NET. I will outline the various strengths and weaknesses of both and focus on those factors that will help you decide which technology you should choose for your development project. There are many factors to consider, and different projects may resort to different techniques. In summary, you'll see a side-by-side comparison of price, speed and efficiency, security, cross-platform support, and more, as well as the advantages of open source solutions.
ASP.NET, the latest version of ASP, is not fully backwards compatible with earlier versions of ASP because the software was completely rewritten. Early ASP technology actually had much more in common with PHP than with ASP.NET, a complete framework for building Web applications. One of the main features of this model is the flexibility in choosing a programming language. ASP.NET can use scripting languages such as VBScript, JScript, Perlscript, and Python as well as compiled languages such as VB, C#, C, Cobol, Smalltalk, and Lisp. The new framework uses the Common Language Runtime (CLR); your language's source code is compiled into Microsoft intermediate language code, which is then executed by the CLR.
This framework also provides true object-oriented programming (OOP) and supports true inheritance, polymorphism and encapsulation. .NET class libraries are organized into inheritable classes based on specific tasks (for example, working with XML or image processing).
In addition to programming languages and methods, database access is also a factor that needs to be focused on. When you program in ASP.NET, you can use ODBC to integrate your database; ODBC provides a consistent set of function calls to access your target database.
The advantage of ASP.NET is obviously its simple design and implementation. It's an object-oriented programmer's dream: the language is flexible and supports complex object-oriented features. In this sense, it is truly interoperable with programmers' existing skills.
Another advantage of ASP.NET is its development environment. For example, developers can use WebMatrix (a community-supported tool), Visual Studio .NET, or various Borland tools such as Delphi and C++ Builder. For example, Visual Studio allows setting breakpoints, tracing code snippets, and viewing call stacks. All in all, it's a complex debugging environment. Many other third-party ASP.NET IDE solutions are bound to appear.
But you gain robustness at the expense of efficiency. ASP.NET is very expensive in terms of memory usage and execution time, mostly due to longer code paths. For Web-based applications, these limitations can be a serious problem, because on the Web, your application may scale to thousands of users per second. Memory usage can also become an issue on the web server.
PHP is a scripting language based on the preprocessed HTML page model. When the PHP preprocessor in the web server finds a PHP language tag like the following, the PHP engine is called to execute the code:
some code here
?>
PHP will be very familiar to any programmer who has used an imperative programming language; you will notice syntactic similarities to Perl, C, and Java. Strictly speaking, Java is an imperative programming language, but it also makes use of object-oriented structures and concepts. PHP borrows from this structure where appropriate, but it is not a pure OOP language.
In the above discussion of ASP.NET, I mentioned the ODBC driver and how applications can be built with database abstraction in mind. In PHP you can also use ODBC to talk to a database, so you already have a range of supported databases to choose from. There are also native drivers for MySQL, Oracle and Postgres. Additionally, if you want to use Oracle, there is a special OCI8 library that will provide more access to Oracle, allowing you to use features such as LOBs, BLOBs, CLOBs, and BFILEs.
At this point you may be asking "Why are database-related libraries called a feature of PHP?" Database abstraction or independence is a problem when you are trying to build for use with multiple databases or need to be portable between databases (for example, from developing a factor to consider when porting) applications to production. And these are indeed things that should be cared about and considered.
But as Tom Kyte points out in his new book — Effective Oracle by Design (Oracle Press) — database dependency becomes your real goal because it will maximize your investment in the technology . If you have general access to Oracle—either through ODBC or Perl's DBI library—then you won't be able to use features that other databases don't have. Additionally, optimized queries vary across databases.
Zend Technologies is a business software company that has made significant contributions to PHP. It created a commercial development environment called Zend Studio that included a sophisticated debugger, a monitor, and other features. The company also built the free Zend Optimizer, which works in conjunction with Zend Encoder to compile PHP code for improved performance. There are other commercial products, such as Zend Performance Suite, which can cache precompiled PHP pages, further improving overall performance significantly.
As of Beta 4, PHP 5 still has some shortcomings, including the lack of exception and event-based error handling routines—their ability to interrupt normal program flow and jump code to a special error-handling section. Java also provides exceptions for error handling, while C++ provides exception handling through try, catch and throw syntax. Of course, you can still manage errors in PHP, but the structure is not standardized, leaving programmers with their own tools to decide how to perform error handling, which leads to less consistency and often a need to start over.
Another weakness is that PHP function names are not case-sensitive. Although this is not a serious disadvantage, some programmers may find this feature annoying.
However, I do have concerns about PHP's object model. PHP is not specifically designed as an object-oriented language. Some of these features were added later — although care was taken to maintain backward compatibility with PHP 3, so some features from both models remain. In fact, many of these weaknesses have been addressed in PHP 5. Please pay attention.
What PHP lacks in some areas, it quickly makes up for in areas where it excels. The price is reasonable so you don't need to worry about licensing issues. It's also open source, so the entire community will follow the development process closely: bugs will be found and fixed. If there's a feature you don't like, you can modify the code. Additionally, PHP integrates naturally with Apache: it can be compiled as a module, or directly into Apache binaries.
But running on Apache means that, with PHP, you can take advantage of any server investment you've already made, because Apache runs on Windows, Linux, Solaris, and a variety of other Unix platforms. Additionally, using a web server with a track record of Apache means security can be kept at the highest priority. Finally, PHP has a smaller code path, which means less server-side code to parse and execute PHP pages, which results in more efficient memory and usage and faster execution.
What are the new features in PHP 5?
The 4th beta version of PHP 5 was launched at the end of December 2003, and the change log clearly shows that many bugs were found and eliminated. While it's still in testing, all of its new features and advancements are certainly worth keeping an eye on.
The main new achievements of PHP 5 are its exception handling and a new object that introduces features that give PHP true OOP. Exception handling is undoubtedly one of the most significant shortcomings in PHP 4, and the introduction of exception handling in PHP 5 is undoubtedly a sign of maturity. Exception handling means that you have language-defined and standardized error handling methods in your software. Just use try, catch and throw methods and your PHP code becomes more robust and concise.
{if (file_exists ($inFile))
{# code to open the file here} else {throw new Exception ("Cannot open file:$inFile");
} }}
$blueObj = new blue ();try {$blueObj->openFile ('/home/shull/file.txt');}
catch (Exception $myException) {echo $myException->getMessage ();
# rest of exception handling code here}# rest of blue methods here?>
The new object model brings many positive effects to programs written in PHP. In PHP 4, when you pass an object to a function or method, it is passed by value — unless you explicitly tell PHP otherwise. This process means that a copy of the object (all data structures in memory) must be made. This step uses memory, making access slow and congested. In PHP 5, objects are usually passed by reference.
The new object-oriented features in PHP 5 (including constructors and destructors) are worth paying attention to. Like C++ and Java, they provide a standard way to create an object, allocate memory, and perform any necessary setup through a constructor method, and perform cleanup through a destructor method.
PHP 5 also introduces finer control over methods and variables within classes. In PHP 4, everything is public: you can access variables in your class from outside the class or in inherited classes. In PHP 5, you can still make variables or methods public, but you can also make them private so that they can only be used within the class itself. They can also be protected, that is, methods and variables can be viewed within the class or in subclasses.
Additionally, PHP 5 introduces type hints or better type checking. When you pass an object to a routine, PHP is able to check that it is the correct type and generate a type mismatch error if the check fails.
Since there are additional features such as static methods and variables and abstract classes, be sure to check the documentation for details.
ASP.NET officially requires you to use IIS. Unfortunately, IIS has a long history of vulnerability, which makes many administrators reluctant to deploy it to handle Web sites. It doesn't matter whether these weaknesses are due to flaws in Microsoft or because IIS is a target for hackers: these systems have a history of being hacked or compromised. PHP also runs on Apache, which is fast and open source and has a good security record. Additionally, as I mentioned, Apache runs on many platforms.
If you're considering ASP.NET, but you want to use Apache as your Internet portal, luckily you have some options. First, you can use Apache to forward requests to IIS running internally on another machine. Apache then processes the static content and delivers the aspx content to the IIS server (not exposed to the Internet).
However, if you want to leverage Apache to host ASP.NET, there are a few options that Microsoft may or may not support. As a last option, there's Ximian's Project Mono, which is dedicated to building an open source module. Please visit www.go-mono.com for more information.
One of the first things you should consider when choosing PHP or ASP.NET is the connection to the database. However, leveraging ASP.NET is more complex because you can choose any of many alternative languages. Of course, these code examples will have to be embedded in HTML pages, instantiated classes, etc. However, the following information will give you an idea of the coding styles of both.
The following is a PHP 5 class that provides an Oracle connection and disconnection routine to demonstrate the use of PHP 5 (other drivers (such as ODBC drivers) and common database interfaces can also be used) to connect to Oracle One way:
class oracle_object {
protected $theDB;
protected $user;
protected $pass;
protected $db;
function __construct($u, $p, $d) {
$this->user = $u;
$this->pass = $p;
$this->db = $d;
}
function db_open () {
$theDB = @OCILogon($this->user, $this->pass, $this->db);
db_check_errors($php_errormsg);
}
function db_close() {
@OCILogoff($theDB);
db_check_errors($php_errormsg);
}
function __destruct () {
print ("so long...");
}
}
If you're looking to leverage VB.NET (Visual Basic is Microsoft's default .NET programming language) to connect to Oracle, take a look at this example from MSDN:
Imports System
Imports System.Data
Imports System.Data.OracleClient
Imports Microsoft.VisualBasic
Class Sample
Public Shared Sub Main()
Dim oraConn As OracleConnection = New OracleConnection
("Data Source=MyOracleServer;Integrated Security=yes;")
Dim oraCMD As OracleCommand = New OracleCommand
("SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER", oraConn)
oraConn.Open()
Dim myReader As OracleDataReader = oraCMD.ExecuteReader()
Do While (myReader.Read())
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}",
myReader.GetInt32(0), myReader.GetString(1))
Loop
myReader.Close()
oraConn.Close()
End Sub
End Class
Assuming you haven’t decided to use PHP yet, I can say that PHP’s strengths far outweigh its weaknesses. (See an overview in Table 1.) These advantages boil down to price, speed and efficiency, security, cross-platform applicability, and open source opportunities. Its only weakness is the lack of a pure and perfect OOP implementation, but this is a minor drawback. While language structure does help, good coding ultimately comes from practice, execution, good habits, and discipline.
Table 1
|
PHP 4 |
PHP5 |
ASP.NET |
软件价格 |
免费 |
免费 |
免费 |
平台价格 |
免费 |
免费 |
$$ |
速度 |
强 |
强 |
弱 |
效率 |
强 |
强 |
弱 |
安全性 |
强 |
强 |
强 |
平台 |
强 |
强 |
弱(仅用于IIS) |
平台 |
任意 |
任意 |
win32(仅用于IIS) |
是否提供源代码 |
是 |
是 |
否 |
异常 |
否 |
是 |
是 |
OOP |
弱 |
强 |
强 |
Here we should not simply consider the initial investment - which is obviously free in the case of PHP - but also the cost of implementation, maintenance and debugging. For PHP, you may want to purchase the Zend optimization engine. However, with ASP, you make an investment from the beginning, and you also pay for additional technology—for example, libraries that perform graphics processing. But in the long run, PHP won't force you to upgrade and charge you more for the license. Everyone who has worked with complex licensing knows that many companies spend vast amounts of time and money just to ensure compliance. Also, when it comes to getting bug fixes, the response you get varies. This of course will translate into time, which will translate into overall development costs.
As I mentioned earlier, ASP.NET is a framework that allows you to use various programming languages. Additionally, it is said to have an excellent object-oriented model. While all of this is true, it's a disadvantage when considering speed. For these reasons, running an ASP page in ASP.NET requires more code to be executed than running the equivalent PHP page in the PHP engine. PHP is a "quick and dirty" solution, a solution designed to get the job done. Although it has received many robust enhancements since versions 2.0 and 3.0, it still retains the core optimized high-speed approach.
Speed is not the only factor to consider. Memory usage is also important.
ASP.NET runs on IIS, and IIS has been attacked countless times — as evidenced by IT news reports every other week. It has become such a burden, in fact, that despite its expensive sales pitch, many IT professionals still refuse to open their networks with an IIS web server. And PHP uses Apache. Apache has a proven track record of speed, reliability, and solid security. Please visit www.securityfocus.com for more information.
ASP.NET runs on IIS and is starting to run on Apache (Apache runs on many platforms). PHP was designed from the ground up to work with Apache, so you have many proven and reliable server platforms to choose from.
Open source isn’t just about some whimsical programmer or a company looking to save some licensing fees. When you're dealing with bugs in the software itself, open source can be a real godsend.
With either PHP or ASP.NET, you have a large user base who use the software and may encounter errors. With ASP.NET, these bugs must be notified through an official process, fixed, tested, and eliminated in a new patch or version. However, PHP patches can be patched and released quickly. Anyone who has witnessed the development of open source knows that new versions and patches are often rolled out within days rather than weeks or months like commercial software. If this isn't quick enough, you can usually patch the problem yourself if necessary.
Advantages of PHP in the field of WEB development
Your current location: Duyao Lao--> Complete collection of technical documents In the eyes of most WEB developers, ASP and JSP are considered the frontrunners, while PHP is considered a weak "struggler", or in other words It is a language that has been relegated to the realm of amateurs and is not worthy of competing in corporate web development. In my opinion, the reason PHP is not considered a contender is due to reviewers' lack of understanding of it and of other operating systems used for web development. Contrary to some opinions, WINDOWS no longer occupies the largest share of the WEB virtual hosting service market, and I suspect that it is also being destroyed in the field of WEB development.
Obviously, PHP is considered to be so far behind ASP and JSP that it is useless, but this is just not true. PHP is a powerful language in its own right. It's available on virtually every distribution of LINUX, and it's also available on MAC OS X. Get building-block tools and software for developing and using PHP code for free. COMMERCIAL INTEGRATED DEVELOPMENT ENVIRONMENTS (IDES) for developing PHP applications. You can also find tools such as KOMODO (which runs on LINUX and WINDOWS) and ZEND STUDIO (this application can run on any computer with JAVA on the operating system of the running environment). The fact that you can run a website built with PHP on almost every web host, regardless of what operating system the server is running, makes PHP even more attractive.
Forget about what is surrounding PHP for a moment, and think about what PHP itself can provide. It is a robust server-side language that provides considerable functionality and can serve pages quickly.
Any user using C or PERL or another language with similar style and syntax can quickly get started with PHP. Although it is designed for use on the Web, it can also be used as a command line language. Does the WEB application you are writing need to execute certain code every hour or every day? Using CRON or a similar scheduling manager, you can schedule PHP code to be executed when you want it, using ordinary shell scripts or batch files to execute such code. There is no need to automatically call the browser to view a specific web page to execute your event, and there is no need to rely on visitor clicks to tell your system that specific code needs to be executed at a specific time. The fact that PHP is scalable in this area is absolutely attractive.
I am not a veteran of JSP or ASP, and I do not want to disparage these languages. Instead, I'll focus on the benefits of PHP.
PHP allows you to provide localized services to your website visitors. When users click through to a website, the website automatically serves pages in their native language based on their browser settings. This is achieved without the use of complicated files for language translation, but by using the same capabilities as localized C programs, through a system called GETTEXT. If the requested language file exists, the text the user sees is his or her native language; if the language file does not exist, the text is the default English or any other language you specify. Many localized UNIX applications use GETTEXT as a standard, making third-party translation a breeze.
PHP supports setting up and executing command line programs where needed. Using the standard UNIX DIFF tool, it is possible to generate the difference between the last modification of the error and the current comment to be emailed to the owner of the error. The PHP code performs a DIFF on two files written on the system, takes their output as input, and generates an email to send. This email is sent via PHP itself.
The above are just two of the powerful features I use in my own programs, but there are many more. For example, you can:
Create simple FLASH animations instantly.
Create PDF documents instantly.
Use advanced mathematical functions and object-oriented programming techniques.
Read and write to local and IMAP mailboxes.
Any standard INTERNET protocol can be used in PHP. Want to write a PHP-based FTP, WEB or news client? No problem! Using only PHP you can write clients and servers that use standard TCP/IP sockets and create your own protocols.
Implement support for encryption and support for various database servers.
I think those who look for the top web development languages and exclude PHP are extremely short-sighted. I've been writing code in PHP for many years, whether it's advanced functionality like a bug tracking system or mundane functionality like simply reusing headers and footers. I've written semi-static pages and full-featured multimedia presentations in PHP. I'm not the only one using PHP. If PHP is not worthy of attention, if it is just a language for children or hobbyists, then why is it the fastest growing language in web development? If it is not as powerful as ASP or JSP, then why is it used on WEB websites with huge traffic? For example, YAHOO, it is said that it is built by PHP.
I'm sure that ASP and JSP have their own strengths, but I believe people use them not because they can provide more powerful functions than PHP, but because people already understand them and want to use what they are used to. method to write code. Excluding PHP only shows ignorance of this language.
Translator's Note: This is a "long essay" written by a German about PHP. In the article, the author boasts that PHP is so magical that it has the power to dominate the world. Regardless of whether its point of view is correct or not, such a classic "bragging article" is very worth reading for us fearful PHP programmers. Without further ado, let’s start appreciating this wonderful piece of deception!
Definition: PHP is a simple, object-oriented, interpreted, robust, secure, very high-performance, architecture-independent, portable, dynamic scripting language. PHP has the Class keyword similar to JAVA. Because it does not require a virtual machine, it is 5 times faster than JAVA. PHP is quickly becoming a standard, general-purpose, object-oriented scripting language. PHP can be used not only to develop web applications but also general applications.
PHP is a powerful scripting language. PHP will defeat PERL/Python and replace it. PHP is the next generation of PERL/Python scripting. PHP can do any job that PERL/Python does, and do it more, better, and more concisely! !
PHP is the abbreviation of Hypertext Pre-Processor, which is a server-side HTML script/programming language. PHP is syntactically similar to C and can run on Apache, Netscape/iPlanet, and Microsoft IIS web servers. PHP as a tool allows you to create dynamic web pages. Web pages using PHP are no different from regular HTML pages. You can create and edit them in the same way. PHP allows you to write simple scripts directly in HTML files, which is very similar to Javascript. The difference is that PHP does not depend on the browser and is a server-side language, while Javascript is a client-side language embedded in HTML. Conceptually, PHP is similar to Netscape's LiveWire Pro product, Microsoft's ASP, and SunMicrosystem's JSP.
PHP can be used not only to create web applications, but also to develop ordinary stand-alone applications.
The power of PHP is:
·PHP is the best technology. Other technologies, such as PERL, Python, Tcl, VB script, and ASP, are relatively old and inferior. Even Java/JSP is under PHP.
·Open Source
·Extensive database connectivity
·A large number of extension libraries
·As a multi-purpose scripting language, it is better than PERL, VB script, ASP and JSP.
Why choose PHP? Because PHP is the best and here’s why:
·PERL "bad taste" because its programs are difficult to read and maintain, and are not object-oriented. Forget PERL and switch to PHP. PERL programmers will abandon PERL because they fell in love with PHP! PHP is actually the "modern version of PERL", just with a different name.
·Java is object-oriented, but very slow. Java programs travel very slowly, and the only complaint about it is-"Java is so slow." And very complex (with many layers, such as JVM, JIT, etc.). This often causes problems. Now that we have Linux, why do we need Java?
·Python is "good", but it doesn't have the parentheses and braces in C, which are very useful for manipulating code in the vi editor. If you can't use the vi/emacs editor's command to search for brackets/braces to quickly manipulate the code, it's like losing your hand. PHP is technically more advanced than Python.
·PHP is the best because it is object-oriented and absorbs the essence of C/C++/Java/PERL. PHP can replace PERL, Python, Java, C, C++, awk, Unix shell scripts, Visual Basic and other languages! ! PHP runs directly and is written in C.
·Every computer programmer knows that PHP is the best. If you don’t believe it, ask the programmer next to you.
·Only PHP can dominate the 21st century, the 22nd century and beyond.
·There is a very important reason why we think PERL, Python and Java programmers will fall in love with PHP.
In the past, many companies in the world regarded PHP as a "highly confidential and strictly confidential" computer programming language, but now it has become the most famous in many fields such as Web, Internet, E-commerce and B2B. The most widely used object-oriented scripting language on projects. Even today, there are still many competing companies that treat PHP as a highly confidential thing and will never reveal anything to the outside world (competitors).
PHP will sweep the entire world like a storm, and the IT industry will be shocked. The power of PHP is that it is cross-platform and can run anywhere. Such as Linux, Windows 95/98/NT/2000/XP, Solaris, HPUX and various UNIX. PHP only needs to be written once and can be deployed anywhere. PHP can run on a variety of web servers such as Apache and Microsoft IIS.
PHP is 5 to 20 times faster than Java! ! Actual comparison tests show that PHP runs about 3.7 times faster than Java. PHP is so easy to use, you can use it to develop very complex web, e-commerce and general stand-alone applications very quickly in a very short time. (In the future, PHP will imitate most of the functions of Java, and I believe Java programmers will also like it. PHP will include keywords in Java, such as class, extends, interface, implements, public, protected, private, etc. etc. )
PHP has object-oriented features, which absorbs the best parts of Java, C++, PERL and C. PHP is arguably the gem among all scripting/programming languages. Soon it will become the Mecca for programmers around the world. PHP can run on Window95/NT/2000/XP or on various UNIX.
We are going to be surprised - PHP is very likely to become the computer programming language of the 21st century.
You can use Zend Optimizer to compile and optimize PHP to make it run faster. Zend Optimizer has been integrated in PHP4.0. First, you write your application in PHP scripting language during development, testing, and debugging. Once the project is complete, you can use the Zend compiler to compile the PHP files into a faster executable program.
For e-commerce projects, you generally need to use a combination of PHP (70%), HTML/DHTML/XML (25%) and 5% Javascript (client-side validation).
PHP originally ran on the UNIX platform, but it is very portable and can also run on Windows and IIS web servers. Today, there are a large number of PHP users based on Windows 2000/NT/95/98, and you can find a large number of PHP tools running on the Windows platform.
Many PHP programmers like to develop their programs on Windows and then deploy them on large Linux servers, such as IBM minicomputers, Compaq DEC Alpha and Sun sparc running Linux.
The biggest advantage of PHP is that it can also run on UNIX/Linux. Developers on UNIX can serve PHP users under MS Windows, and PHP code developed under Windows can also be used without any changes. For use on UNIX/Linux.
PHP itself is entirely written in C language, so it can be widely run on various platforms, such as BeOS, UNIX, MS Windows, Apple Macintosh, IBM OS/2 and other operating systems.
PHP runs very fast, much faster than Java. For web development, forget about Java/JSP! PHP, PHP, PHP everywhere! PHP will also become a versatile object-oriented scripting language.
·PHP main site: http://www.php.net
·PHP resources: http://ils.unc.edu/web-db/php/links.html
·PHP code exchange: http://px.sklar.com
·Vex Net: http://www.vex.net/php
There are mirror sites in many countries, the URL is www.COUNTRYCODE.php.net, where COUNTRYCODE can be us, fe,, sk, etc.
· http://www.fe.de.php.net
· http://www.sk.php.net
· http://php.iquest.net/
·Q&A email address: rasmus@lerdorf.on.ca
PHP is extremely popular on the Microsoft Windows platform, and surprisingly, it is more popular than Microsoft's own web scripting language. The reason is that PHP is an object-oriented scripting language, while ASP is not. PHP has a large number of reusable classes (objects). On the Windows platform, PHP is much faster than ASP and has more functions and features than ASP. PHP is more robust, reliable, and powerful than ASP. Since PHP can run on MS Windows, Linux, Mac OS and all UNIX, it has a large user base. And its biggest advantage is that you can develop programs on Windows and then configure them on UNIX/Linux, and vice versa.
There are more PHP users under Windows98/NT/2000 than other operating systems. That is because it is very simple to install PHP on Windows98/NT/2000.
PHP has an executable installation program. You only need to double-click the exe file and it will be automatically installed within 2 minutes. The executable PHP installer can be downloaded from the following site:
·PHP executable installation program under Windows: http://php.weblogs.com/easywindows
·PHP information under Windows platform: http://php.weblogs.com
·PHP installation and configuration under Windows: http://www.php.net/manual/install-windows95-nt.php
·PHP Triad can install a complete PHP service environment on the Windows platform: http://www.phpgeek.com
To run PHP on Windows, you need a web server. You can use Microsoft's IIS or the free Apache. Because it can be installed through Apache's installation file setup.exe, it can save you a lot of time.
PHPTtriad is a software package including Apache, PHP, and MySQL. It can be downloaded from http://www.phpgeek.com/phptriad.php or its mirror site http://sourceforge.net/projects/phptriad. I highly recommend using PHPTtriad, which is extremely popular among Windows users (has been downloaded millions of times).
Apache binaries: http://httpd.apache.org/dist/httpd/binaries/win32
SQL server can be installed on a machine that does not need to run Windows, and you also need a SQL server for web development. I recommend you install Redhat Linux and PostgreSQL RPMs on a very old PC (such as a Pentium or 486). Your database does not require any Windows graphical interface, you can start PostgreSQL directly from the console. PostgreSQL is about 3 times faster than Oracle and MS SQL server.
PHP’s PostgreSQL support library is written by Adam Sussman, his email address is: asussman@vidya.com
PostgreSQL supporting Windows NT/2000 can be downloaded from http://www.askesis.nl. The PostgreSQL usage guide is available at http://www.geocities.com/alavoor/HOWTO/pgsql/PostgreSQL-HOWTO.html.
See the installation guide and instructions on the PHP main site www.php.net, or the INSTALL file in the downloaded package.
The steps to implement a project using PHP’s object-oriented mechanism are as follows:
·First, you need to connect to a database SQL server - there are two options:
ADODB (Active Data Objects Data Base), dynamic data object database (http://php.weblogs.com/adodb)
Metabase (Database independent access and management), that is, database independent access and management (
http://phpclasses.upperdesign.com/browse.htm/package/20)
·Second, you need some common PHP classes to create forms, tables, and other HTML objects. These are available from the PHP classes website (http://phpclasses.upperdesign.com). You can refer to the download ranking list of this website. You can also obtain form classes, template classes, etc. from the website http://www.milkywaygalaxy.freeservers.com/.
·Third, design and create your own PHP classes by inheriting these common classes.
·Fourth, use template classes to separate display styles and business logic, see http://www.phpclasses.com
·Fifth, use IDE tools for development (see the PHP IDE section).
·Finally, it is best to encapsulate your code into classes, so that the code can be easily maintained and reusable.
·Supports standard CGI, FastCGI and Apache modules - As a standard CGI program, PHP can be installed on any UNIX machine running any web server. PHP supports the new FastCGI standard. Through this mechanism, PHP has gained speed improvements. When configured as an Apache module, PHP becomes an extremely powerful, lightning-fast new choice.
·Access Log - Through PHP's log access function, users can maintain their clicks and logs. This feature provides real-time access monitoring without using the system's central access log files in any way. The log browsing script provides a quick summary of visits to a set of pages owned by an individual user. In addition, the package can be configured to generate a footer for each page to display access information. Please refer to the examples at the end of the article.
·Access control - a built-in web-based configuration "screen" that can configure access control. In this way, it is possible to create a set of rules for all or part of the web pages, so that a specific person who owns these pages can set various restrictions on his web pages, such as who can access these pages and in what way these pages can be accessed. method is accessed. There are many ways to configure the page, such as password protection, full restriction, login invalidation, or more based on the customer's domain, browser, e-mail address or even other documents involved.
· Support for PostgresSQL - PostgresSQL is an advanced but free RDBMS (relational database management system). PHP supports embedding PostgresSQL's "SQL query statement" directly in the .html file.
·Support RFC-1867 file upload - File upload is a new feature of Netscape2.0. Users can upload files to the web server.
PHP provides actual MIME decoding functionality, making file uploading possible. PHP also provides additional frameworks that perform some useful processing on received uploaded files.
·HTTP-based authentication control - PHP can be used to create custom HTTP-based authentication mechanisms for the Apache server.
·Variables, arrays, associative arrays - PHP supports typed (I don’t know how to translate this word, I hope an expert can guide me) variables, arrays, and even Perl-style associative arrays. And these can be passed from one page to another through the GET or POST method of the form.
·Conditional statements, While loops - PHP is a fully functional scripting language similar to C language. You can use if/then/elseif/else/endif conditional statements, as well as While loops and Switch/case statements to arrange the logical flow of HTML page display.
·Extended regular expressions - Regular expressions are frequently used for pattern matching, pattern replacement, and general string manipulation. PHP supports all common regular expression operations.
·Original HTTP Header control - Allowing web pages to send customized original HTTP headers according to certain conditions is very necessary for some advanced website designs. A common usage is to send a Location:URL header to redirect the client's request to another URL. It can also be used to turn off caching or manipulate the latest updated HTTP headers of the page.
·Dynamic creation of GIF images - PHP already supports Thomas Boutell's GD image library, which can realize the dynamic creation of GIF images.
·Support ISP "Safe Mode" - PHP supports a unique "Safe Mode", making it safer for multiple users to run PHP scripts on the same server.
·Many new features have been added to the newly released PHP. The main PHP site can be accessed at http://www.php.net.
·PHP is free! ——This is the last important feature. PHP packages are completely free. It complies with GNU/GPL. You can use this software for business or any other purposes.
PHP is an established server-side scripting language for creating dynamic web pages. As a language designed specifically for the Web, PHP brings many features that business organizations crave.
·Short maintenance cycle
·Fast development time
·Very high performance
PHP can run on all major operating platforms (UNIX, Windows, and even mainframes), and natively supports a variety of popular databases. All of this determines that it is an ideal choice for web development: online stores that have used PHP technology claim that they can develop reusable code within a few days. Programmers who are familiar with languages such as C, C++, or Java often find that they can program PHP within a few hours.
The fact that PHP is designed for web development makes it a unique development tool, as Intranet Design magazine commented:
“PHP is built on the real needs of web developers....Unlike other clunky, high-load methods, PHP is very lightweight and tailor-made for web development. It can outperform other similar technologies Solve complex problems faster and easier. ”
Java, as a new programming language, was originally used to run client applications embedded in browsers. In the past few years, the problems exposed by "applets" have forced Sun and other Java developers to find new ways for the language. The most prominent of these is server-side programming, which allows Web sites to connect to databases and generate other server-side applications, known as "servlets." SUN eventually introduced Java Server Pages (JSP) as a means of writing servlets. Like PHP, JSP is highly portable across different platforms (although PHP supports any 32-bit and above platforms, JSP can only run on platforms with a Java Virtual Machine installed). However, newbies with no programming background will find that programming with servlets is extremely difficult due to the complexity of the language and the complex way in which JSP systems are designed.
The performance of JSP also has many areas for improvement: a recent survey by ZDnet's online publication eWeek found that PHP runs almost 3.7 times faster than JSP. It can be said that JSP is a very poor solution in the Web environment because it can only handle very few transactions per second and the response speed is quite slow.
ZDnet’s eWeek magazine also mentioned:
"JSP is a relatively new technology. In terms of development tools, resources, and talents, it has not yet reached full market maturity."... Since JSP is based on Java, and Java Since it is a strongly typed language, we have to declare the types of variables and manually convert types where needed. This makes JSP one of the most difficult scripting languages for programmers to learn.
PHP works with Java
It is important to realize that JSP is just a language that can access Java objects. PHP can also integrate Java, which means that, like JSP, PHP can become a scripting language that can call Java logic. But unlike JSP, PHP can also call other component models, such as Microsoft's COM, and it is extremely easy to add support for new object models. It can be seen that PHP's expansion capabilities are endless. JSP, on the other hand, is completely dependent on Java.
IBM programmer Sam Ruby uses PHP and Java together. Through PHP's good support for Java, Java objects can be created and used transparently like regular PHP objects.
AutionWatch allows business groups of all sizes to benefit from its dynamic bidding environment. It has more than 2.6 million visitors per month; has more than 300,000 registered users; and conducts 1.2 million auctions every month. They tried using Java, but chose PHP because it was easier to use and faster to develop. For more information, please contact Ben Margolin, Director of AuctionWatch Sales Services (ben@auctionwatch.com).
Programming consultant Reuven Lerner has made comparisons between various languages. His thoughts on PHP are summarized as follows:
“This is an easy language to learn. Artists and web designers may say that they are not programmers, but in fact, they are increasingly using JavaScript, VBScript and other simple programs in large projects. Programming language. PHP is more formal and explicit than Perl; it is easier for a newbie to learn than Java. Indeed, PHP is a bit like JavaScript (if a server-side version exists) for anyone, regardless of programming experience. , you can learn and use PHP in a short time. Maybe VBScript can do this, but Perl and Java certainly can't... It's no wonder that PHP is an extraordinary and powerful system for creating the Web. The popular language of the site... I think that PHP will become a strong competitor to Java and JSP, and I will highly recommend PHP for certain clients and internal company projects."
PHP: Keep moving forward
JSP has Sun as its backing, so it continues to gain media attention. But what's interesting is that despite no publicity campaign, PHP's popularity is still growing at a rate of 8-11%, which is much greater than the 4% monthly growth rate of server-side applications. Six and a half million sites use PHP (see Netcraft May 2001 survey report). PHP is configured on 39% of Apache servers; while Perl accounts for 11% of the market share, ranking fourth. Apache maintains a 59% Web server market share; Microsoft is second with only 28% (see E-Soft Inc./SecuritySpace May 2001 survey report).
Famous companies using PHP include: Unilever, Philips, NTT, Cisco, Japan Airlines, Air Canada, Lufthansa, GE Marketplace, Wallstreet:Online Germany, AuctionWatch, VillageVoic, Dialpad and BMC.
1. Intranet Design Magazine: An IT Manager’s View of PHP, June 4, 2000.
http://linuxtoday.com/news_story.php3?ltsn=2000-06-04-002-04-NW-HL-SW
2.eWEEK: Speed Development of No. 4 Script Language, October 30, 2000.
http://www.zdnet.com/eweek/stories/general/0,11011,2646052,00.html
About the future of PHP (3)
PHP was originally a simple and compact CGI tool written in Perl. It was called "Personal Home Page Tools" and was later renamed "Personal Home Page Construction Kit" .
was also called "Professional Home Pages", and now the latest name is
"PHP Hypertext Pre-Processor"
There is also a tool that can embed SQL query statements into Web pages very simply. This tool can basically be regarded as another CGI tool that parses SQL query statements and creates forms and tables very easily based on this. This tool is called FI (Form Interpreter, form interpreter).
PHP/FI2.0 completely rewrites these two packages and merges them into a single program. It eventually developed into a simple programming language embedded in HTML files. PHP by placing simple scripts directly in HTML files
Eliminates the need to create lots of tiny Perl CGI programs. Because the load of calling the Perl program multiple times is eliminated, the overall performance of your Web page is greatly improved. Greatly improves the overall performance of your web pages. And by putting all the components that make up a Web page in a single HTML file, management of large sites becomes easier. Since it includes support for various databases, it is very easy to develop database-based Web pages. Many people agree that this approach is simpler than creating separate HTML and CGI files.
Now, PHP/FI has been renamed PHP.
Suppose you have a form like this:
Your display.html file can display the content submitted by the form like this:
echo "HI $name, you are $age years old!
"; ?>
It’s so easy! PHP automatically creates variables for each form input field. You can directly go to
Use these variables in the file pointed to by ACTION.
Once you figure out how to use variables, the next step is to write some logical flows in the page. For example, if you want to display different messages based on different user inputs, you can use if/else statements. By changing the above example, we can display it differently according to the age entered by the user:
if($age>50);
echo "Hi $name, you are ancient!
";
elseif($age>30);
echo "Hi $name, you are very old!
";
else;
echo "Hi $name.";
endif;
?>
PHP provides a very powerful scripting language that can do much more than the simple example above. See the PHP scripting language section for more information.
You can also use PHP to configure page access permissions. This is accomplished through a built-in configuration interface. For example, you can specify that only users from a specific domain can access your page. Alternatively, you can create a rule to password-protect specific pages. See the Access Control section for details.
PHP is also capable of uploading files from any RFC-1867 compliant web browser. This feature allows users to upload text and binary files. Through PHP's access control and logic functions, you can achieve complete control over who can upload files and what operations are performed after the files are uploaded. See the file upload section for details.
PHP has a support package for PostgreSQL database. It supports embedding SQL query statements in HTML files.
SOAP is an XML-based protocol used to transmit messages and perform RPC-style communication between two processes. The World Wide Web Consortium's XML Protocol (XP) working group is developing the SOAP standard, which will be called XP.
SOAPX4 (Simple Object Access Protocol, Simple Object Access Protocol) is a PHP implementation:
http://dietrich.ganx4.com/soapx4.
and http://sourceforge.net/projects/phpxmlp.
Krysalis is an XML/XSLT publishing engine based on PHP technology, and its design ideas come from Cocoon.
InterAKT developed Krysalis to achieve the functionality of next-generation Web services, which is the complete separation of information, application logic and presentation layers.
Krysalis is an open source PHP development platform with XML/XSLT as the core. It uses most of the code of PHAkt to create the Krysalis tag library (taglib).
The main functions are:
·Dynamic XML support.
·Dynamicly generate PDF documents.
·Use regular expressions to describe the sitemap.
·PXP page caching.
·Multiple conversion pipelines.
·Multiple connection types for different data (ADODB).
Please visit Krysalis’ site for more information http://www.interakt.ro/products/krysalis
PHP is an object-oriented scripting language. So PHP code is "classes, classes, classes, classes". When you write PHP code, you must write reusable classes that can also use existing classes. There are a large number of well-written classes on the Internet that are ready to use. There are classes for accessing databases, classes for generating XML documents and HTML forms, and classes for creating tables and other HTML objects. If you have written any general class, please put it online. By 2005, there will be more than 100 million reusable PHP classes on the Internet. The advantage of PHP classes is that they provide functions and features such as data hiding, inheritance, encapsulation, reliability, reusability, and polymorphism. The most important PHP sites are given below:
You can visit the following website to get a large number of PHP libraries that can be used immediately
·PHP classes: http://phpclasses.upperdesign.com.
·PEAR (PHP Extension and Application Library) is a code library for PHP extensions, similar to Perl's CPAN: http://pear.php.net
·ADODB (Active Data Objects Data Base, Dynamic Data Object Database) http://php.weblogs.com/ADODB: PHP’s database access functions are not uniform. Each database extension uses different and incompatible API functions. This requires creating a database class to hide the differences between different databases (that is, to encapsulate the differences between different databases). Thus, we can easily switch databases. ADODB currently supports MySQL, PostgreSQL, Interbase, Oracle, MS SQL 7, Foxpro, Access, ADO, Sybase and general ODBC. Please refer to the ADODB manual. PhpLens is based on ADODB.
·Metabase (database independent access and management)
http://phpclasses.upperdesign.com/browse.html/package/20
·PHP Hot scripts: http://www.hotscripts.com/PHP
·Very popular PHP resource site: http://php.resourceindex.com
·PHP project site: http://php.net/projects.php
·PHP Lib Netuse: http://phplib.netuse.de
·PHP widgets: http://www.northern.ca/projects/phpwidgets
·PHP4 general framework: http://sourceforge.net/projects/gpfr
·Source Forge’s PHP library: http://phplib.sourceforge.net
·Source Forge’s PHP program snippet: http://sourceforge.net/snippet
·E-gineer’s PHP library http://e-gineer.com/articles/php-hacker
·PHP FAQ: http://php.faqts.com
·PHP library http://px.sklar.com
·PHP Factory: http://alfalinux.sourceforge.net/phpfact.php3
·PHP Builder: http://phpbuilder.com/snippet
·PHP developer: http://www.phpdeveloper.org
·Newbie to PHP: http://www.newbienetwork.net
· PHP walrus: http://www.evilwalrus.com
Other PHP tools include:
·User login sample: http://www.devshed.com/Server_Side/PHP/Commerce1
·phpPDFtable is a PHP class that facilitates the creation of PDF reports. PHP4.x (PHP3.x should also work) and pdflib need to be installed: http://sourceforge.net/projects/phppdftable
·Data Manager provides a PHP-based data management interface. It's not limited to one or two databases. And encapsulates the original PHP database access function: http://sourceforge.net/projects/dadmin
· PSlib is a class library used to generate PostScript files. Provides a simple method to generate PostScript files. You can easily generate PS files by simply calling the PSlib function in your PHP script: http://sourceforge.net/projects/pslib
· A complete set of PHP scripts that work closely together to create highly customized, dynamic and module-oriented web sites: http://sourceforge.net/projects/twebs
·phpOpenTracker is a comprehensive solution for site visit tracking. The collected data is stored in a SQL database. Can perform complex but simple analysis work. Contains a powerful API for analysis and report generation (HTML and PDF): http://www.phpopentracker.de
·PHPShopCart is an online shopping cart program written in PHP and uses MySQL database. This program was written for the book "Database Guide under Linux" (Syngress Media): http://sourceforge.net/projects/phpshopcart
PHPGem itself is also a PHP script program, which can accelerate the generation of PHP scripts that operate data tables. Can work with different SQL databases, such as PostgreSQL, MySQL, mSQL, ODBC and Adabas. You only need to enter the description information and parameters of the data field (such as field name, yes/no search field, etc.), and PHPGem will output another PHP script for you, which can perform various operations on this data table (browse/add/ edit/delete/copy/search). PHPGem supports multi-level nested data tables. PHPGem allows you to specify the level of access to each table and field for each user. PHPGem also supports image information.
Netscape co-founder Marc Andreessen predicted at the Zend/PHP conference that the simple PHP descriptive language writing tool will be more popular than Java in the development of Web-based applications.
After Sun Microsystems released Java in 1995, Java’s friendly interface made it easier for engineers to design software and was welcomed by engineers. However, over the past ten years, powerful functions have been added to Java one after another, but instead Make it not easy to operate. Marc Andreessen pointed out that current Java may be more difficult to learn than C++. At the same time, PHP inherits the simple spirit of Java and creates a program development environment that is easier to use than Java.
PHP is an open source project, which includes a descriptive language engine that can simplify programs and a large link library. There are also companies that specialize in developing PHP. For example, Zend sells PHP suite products, program writing tools, and technical support. Serve.
Andreessen’s views may be difficult to win the approval of Java advocates, because there are still millions of engineers around the world specializing in Java, and hundreds of companies participate in the Java Community Process (JCP) and co-chair the JCP. The fate of Java. However, even IBM, which vigorously supports Java and even uses Java as the core of WebSphere server software, believes that PHP has a better future than Java.
Rod Smith, vice president of IBM's New Network Technology Division, said that "simplicity" is the biggest feature of PHP, and it will not add new language features in order to compete with other languages. This is obviously not the case with Java.
Moreover, PHP’s power is not small. Currently, about 22 million websites use PHP, including well-known websites such as Yahoo! and Lufthansa. The number continues to increase, and 450 software engineers have the authority to review PHP software. any changes on.
Compared with Java, PHP has more limited scope of use. It can only be used on network servers. Unlike Java, it can be used on network servers, personal computers, mobile phones, chip cards or other devices.
In addition to competing with each other in some aspects, Java and PHP are also relying on each other to a certain extent. Ken Jacobs, vice president of product strategy at Oracle, said that even though Oracle sells Java server and database software that can run both Java and PHP, it is adding an additional new feature to Java so that the two software projects can work together. ; More specifically, Java Specification Requirement 223 (JSR 223) will "help build the bridge between the Java community and the PHP community."
Marc Andreessen, who just recently launched "Ning", a website that can share photos and other content, also said that now Ning also runs Java and PHP at the same time. The core system is composed of Java. Compared with all visible applications on the site, Written in PHP, Java is more like an operating system layer.
Like other open source projects such as Linux and Apache, PHP is currently being protected by major manufacturers in the computer industry. IBM and Oracle are both committed to developing programs that allow PHP software to retrieve their databases. In fact, IBM and Oracle act like they are endorsing PHP. Even these two major companies support PHP, which proves that PHP may be a good thing.
The information that I collected in the past is now shared with everyone.
Nangikaze Koenko -- more serious PHP platform development