PHP explained.
- PHP
-
Интерпретируемый (скриптовый) язык програмирования высокого уровня изначально задуманный для упрощения создания динамического контента на веб серверах. В соответствии с начальной целью абревеатура РНР расшифровывалась как Personal Home Page Tools, однако с 1997го года, после расширения возможностей языка, данное сокращение обрело иной смысл PHP: Hypertext Preprocessor.
Благодаря своей простате как в изучении или написании кода, так и в использовании PHP завоевал огромную популярность.
Recommended PHP reading list
Development environment
Zend Studio is a commercial IDE from the company that architected the PHP engine. This editor provides syntax highlighting with code assist and supports debugging, source control, documentation, and database connections from within the tool itself.
Eclipse is a free open source, platform-independent software framework for delivering rich-client applications. PHPEclipse is an Eclipse plug-in that offers a complete IDE experience, including parser, debugger, code formatter, outline view, and templates. This article provides instructions on configuring and installing Eclipse with the PHPEclipse plug-in.
jEdit jEdit is a free software text editor written in the Java™ programming language, so it runs in multiple platforms and is extensible via plug-ins. jEdit supports PHP syntax highlighting and additional features, such as syntax validation and code navigation, available through the PHP plug-in PHPParse.
Deployment
Zend Core for IBM is a seamless out-of-the-box, easy-to-install, and supported PHP development and production environment. The white paper provides a high-level overview. The installation guide and user guide will help get you up and running quickly.
Install XAMPP for easy, integrated development
Open source stacks such as XAMPP from Apache Friends are simplifying open source development by making it easier to write and distribute applications in a stable, standardized environment. Learn how to install, configure, and back up XAMPP on Mandrake Linux V10.0, learn how to configure and administer XAMPP, and learn how to install your own applications in an XAMPP environment.
Source control
Whether you’re collaborating with a team or need to preserve versions of your own files, source control is the answer.
Tools for Writing Better PHP Code -- Version Control with Subversion
Jeff Knight and Andrew Yochum demonstrate how Subversion can be used to manage multiple projects and developers, as well as development and production environments
“Create a blog from scratch with PHP and Subversion”
PHP is a great Web programming language to use when creating dynamic Web sites, such as blogs. This tutorial explains how to build a blog from scratch, while storing data using flat files. The Web site will be backed up on a remote system using Subversion, protecting data in the event of a Web-site crash. Subversion is growing in popularity, and it is a great candidate to back up the site. With Subversion, it’s also possible to roll back the Web site to earlier versions of the blog if your server crashes, or if you just didn’t like last week’s rambling
Learning PHP
With a development environment in place, you can learn about PHP’s core functionality and begin writing code.
Zend maintains a collection of PHP 101 introductory tutorials for those who are new to PHP.
“Introduction to LAMP technology”
This tutorial explores the LAMP Web development framework and shows how that framework can help you build applications to solve common business problems. The tutorial begins with an exploration of the LAMP architecture, then introduces fundamental PHP concepts. After a solid grounding of PHP, the tutorial explains MySQL support, with coverage focusing on database concepts and how to access MySQL from PHP. All of these techniques are discussed within the context of a real-world customer management example.
“Getting started with objects with PHP V5”
This article describes the fundamentals of objects and classes in PHP V5, from the very basics through to inheritance, for experienced object-oriented programmers and those who have not yet been introduced to objects.
This tutorial is Part 1 of a three-part series that takes you from the most basic PHP script to working with databases and streaming from the file system by documenting the building of a document workflow system. Look at the basics of building a PHP script, including syntax, HTML forms, and database connections.
This tutorial is Part 2 of a three-part series that takes you from the most basic PHP script to working with databases and streaming from the file system by documenting the building of a document workflow system. Here, documents are uploaded by users and stored in a non-Web-accessible location for retrieval by the application in Part 3. Also look at working with XML files using DOM and SAX, and at exceptions.
This tutorial concludes a three-part series that takes you from the most basic PHP script to working with databases and streaming from the file system by documenting the building of a document workflow system. Learn about using HTTP authentication, streaming files, and how to create objects and exceptions.
Advanced PHP
Once you’ve gotten your feet wet with PHP, you might choose to enhance, refactor, or extend your application.
The May 2005 IBM developerWorks article “Getting started with objects with PHP V5” covered enough detail to get a reader up and running with the basics of classes and objects in PHP. This article introduces some of PHP V5’s more advanced and design-oriented features. Among them are object types, which allow for decoupling the components of a system from one another, creating reusable, extensible, and scalable code.
Introduction to PHP Image Functions
PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of image formats, including GIF, PNG, JPG, WBMP, and XPM. Jeff Knight talks about using the GD library and the bundled version in PHP. He covers installation and configuration, a discussion of the image functions themselves, and related topics like patent laws and basic color models and theory.
“Create graphics the smart way with PHP”
Learn to build an object-oriented graphics layer in PHP. Using object-oriented systems can make building complex graphics much easier than building the graphics using the primitives in the standard PHP library.
“How to use regular expressions in PHP”
Regular expressions can provide a powerful way to work with text. Using regular expressions, you can do complex validation of user input, parse user input and file contents, and reformat strings. PHP provides simple methods that let you use POSIX and PCRE regular expressions. Discover the differences between POSIX and PCRE, and how you can use regular expressions and PHP V5.
“Reading and writing the XML DOM with PHP”
Myriad techniques are available for reading and writing XML in PHP. This article presents three methods for reading XML: using the DOM library, using the SAX parser, and using regular expressions. Writing XML using DOM and PHP text templating is also covered.
“Using AJAX with PHP and Sajax”
For years, the goal of creating a truly responsive Web application was hampered by one simple fact of Web development: To change the information on part of a page, a user must reload the entire page. Not anymore. Thanks to asynchronous JavaScript and XML (AJAX), we can now request new content from the server and change just part of a page. This tutorial explains how to use AJAX with PHP and introduces the Simple AJAX Toolkit (Sajax), a tool written in PHP that lets you integrate server-side PHP with JavaScript that makes this work.
PHP 5 and Design Patterns: An Introduction
Matt Zandstra introduces experienced programmers to design patterns in PHP V5. Patterns are shared solutions to commonly encountered problems in software development and can be effectively applied to PHP V5 applications, thanks to its new object-oriented features.
Debugging and profiling
“Debugging techniques for PHP programmers”
Explore various methods for debugging PHP applications, including turning on error reporting in Apache and PHP, and placing strategic print statements to locate the source of more difficult bugs through a simple example PHP script. The PHPEclipse plug-in for Eclipse, a slick development environment with real-time syntax parsing abilities, is also covered, as is the DBG debugger extension for PHPEclipse.
Learn how to use the Advanced PHP Debugger (APD) to profile your PHP code. Code profiling helps you identify bottlenecks or inefficient code in your application, enabling you to tune the code where needed.
The Advanced PHP Debugger (APD) is a Zend extension that provides traces suitable for debugging and profiling code, as well as full stack backtrace. Events-based logging is also supported, so different levels of information logging can be set on a script by script basis.
Xdebug is an extension that offers debugging information, including full traces and function/line indicators. Xdebug also includes profiling and script execution analysis.
IBM database servers
Traditionally, developers have connected to IBM database servers through the Unified ODBC functions in PHP. IBM now recommends using the new PECL ibm_db2 extension for PHP V4 and PHP V5, or PDO for PHP V5 when building new applications. You can decide which extensions are available when compiling PHP, or use Zend Core for IBM to provide you with preconfigured options.
Developing PHP Applications for IBM Data Servers
This Redbook describes the installation and configuration details for setting up the IBM data servers and Apache Web application server for PHP applications. Including Zend Core for IBM, Zend Studio installation and configuration, it discusses the process of porting PHP applications from MySQL V5 to DB2 UDB V8.2.
DB2 and Cloudscape Open Source Development
This is an aggregation of many of the resources for developers planning to use PHP with IBM database servers.
IBM’s new partnership with Zend Technologies makes PHP Web development even easier. This article provides an overview of PHP development for IBM database servers and discusses the challenges and solutions at a high level.
IBM DB2 Universal Database, Cloudscape, and Apache Derby
This presentation provides an excellent technical overview of the APIs available for connecting to IBM database servers from PHP.
“Application development with DB2 UDB”
When it comes to application developers, no other database provides the level of tooling and language integration like IBM DB2 Universal Database (DB2 UDB). If you’re exploring the world of Web services vis-a-vis a services-oriented architecture (SOA), the DB2 UDB database platform is there for you, whether you chose to write your applications in PHP, the Java language, or .NET. See for yourself just how easy it is to develop applications for the DB2 platform.
“Develop IBM Cloudscape and DB2 Universal Database applications with PHP”
Learn to configure IBM Cloudscape V10.0 and DB2 UDB V8.2 servers for access from PHP V4.x and PHP V5.x. Write database applications using the Unified ODBC extension. Overcome common performance issues due to scrollable cursors and avoid functional limitations in stored procedures.
“Making the Most of PHP with DB2”
Justin Whitney describes the new ibm_db2 extension in detail, showing how to perform data manipulation tasks, as well as error handling, transactions, and prepared statements.
“DB2 Universal Database and the PHP Developer? Absolutely!”
Paul C. Zikopoulos introduces the PHP DB2 APIs and demonstrates the new database connection functionality in Zend Studio provided by the Zend Core for IBM add-in.
“Apache, Cloudscape, and PHP on Linux: A winning combination”
Would you like to know how to build a PHP database application from scratch? This tutorial shows you how to install the DB2 Run Time Client, which allows you to access the IBM Cloudscape database. Also learn to install and configure the Apache Web Server to host the application, and compile and configure the PHP module for Apache. The last part of the tutorial shows how to use the Cloudscape Network Server and Apache to verify our database application.
“Connect PHP to DB2 and Cloudscape via PDO”
PHP V5.1 is set to ship with a new database connectivity layer known as PHP Data Objects (PDO). While PHP has always had good database connectivity, PDO takes PHP to the next level.
“Zend Core for IBM technical roadmap”
The Zend Core for IBM provides a seamless out-of-the-box PHP development and production environment, supported by Zend and integrated with IBM’s Cloudscape and DB2 UDB database programs. The product includes native support for XML and Web services in support of increased adoption of SOA. It delivers a rapid development and deployment foundation for database-driven applications and offers an upgrade path from the easy-to-use, lightweight Cloudscape database, to the mission-critical DB2, by providing a consistent API between the two.
“Zend Core for IBM -- A guided tour for PHP developers”
Have you considered setting up PHP V5 on your Linux server, but not had the time to learn how? This article will help guide you through the installation of a PHP V5 environment using the industry’s first integrated PHP environment that includes the IBM Cloudscape database server. Installation and configuration is greatly simplified using Zend Core for IBM compared to setting up a complete development and deployment environment from scratch.
Zend Core for IBM also provides commonly used PHP extensions and DB2 client libraries to get you connected to your DB2 UDB servers. Support for Zend Core is available from Zend Technologies, a leading provider of PHP products and services, but it is a free download and a time-saver for any PHP developer who wants to build Web applications for IBM Cloudscape or DB2 UDB..
“DB2 Express-C, the developer-friendly alternative”
There are many no-charge Relational Database Management System (RDBMS) options available. Some are open source, and some are available from commercial vendors at no charge. If you are developing applications using C/C++, Java technology, .NET, or PHP and are looking for a proven data server with innovative technology and a growing developer community base deployed in many critical business solutions, it’s time to take a look at DB2 Express-C.
Find out how to get started quickly using DB2 Express-C for all of your applications, and review an automation and tuning scenario to optimize your application..
IBM Web and application servers
PHP can also be integrated with other IBM software products.
“Hosting PHP applications on the IBM HTTP Server”
IBM maintains its own copy of the Apache Web server and ships it as the IBM HTTP Server, along with its WebSphere® Application Server. This Web server is fundamentally Apache, and as such, can host and run applications written in PHP. Learn the differences between the open source Apache Web server and IBM’s version, and view demonstrations of IBM’s version running a well-known PHP application.
“Pair J2EE with PHP to implement a common Web application infrastructure”
Conventional thinking often pits the AMP stack of open source technologies -- made up of Apache, MySQL, and PHP -- against Enterprise Java applications and IBM middleware. Sure, each camp has something to fit in the Web server role, each has something for the business layer, and each has something else for the data tier. But can’t we all just get along? Of course we can, says Daniel Krook, who shows how and when it can be beneficial to mix and match these once-considered-mutually-exclusive solutions to exploit their relative advantages and develop new and innovative applications.
“Run PHP applications in Apache Geronimo”
PHP has been a popular scripting language for some time. However, with the growing buzz over Java technology and Apache Geronimo, a J2EE-certified application server, many experienced developers shy away from using PHP with Geronimo because only JavaServer Page (JSP) technology is supported out of the box. The PHP Java Bridge solves this problem by providing full support for PHP on Geronimo and for sharing sessions across PHP and JSP scripts.
Third-party services
PHP can tie into many third-party services to support complex e-commerce applications.
“Develop apps with Web services and the eBay SDK, Part 1”
The face of eBay that most people are familiar with is the company’s Web presence. Learn how to write a small application that allows users to execute ad-hoc queries against eBay through eBay’s SOAP API. The application uses the eBay Java SDK. The use case is targeted at a small subset of the API, but you can generally apply the principles.
“Develop apps with Web services and the eBay SDK, Part 2”
Demonstrate good system integration practices. Learn how to develop a Java application using the eBay SOAP SDK. Part 2 of this series focuses on integrating the application with eBay’s Web services, using the authentication and authorization system, and making API calls.
“Develop apps with Web services and the eBay SDK, Part 3”
Create applications in PHP V5 that interact with eBay through Web services. Almost half of eBay’s transactions occur through its Web services platform. Acquire a solid understanding of the mechanics of the eBay XML API and learn how to use the Services_Ebay PHP extension.
“Create a Web storefront using PHP and PayPal, Part 1”
This series chronicles the building of a Web storefront in PHP using PHP Data Objects to access a Derby database. The storefront includes a user-manageable shopping cart that allows item purchases using PayPal and includes the ability for merchants to notify customers via e-mail on successful orders automatically.
“Create a Web storefront using PHP and PayPal, Part 2”
This series chronicles the building of a Web storefront in PHP using PHP Data Objects to access a Derby database. The storefront includes a user-manageable shopping cart that allows item purchases using PayPal and includes the ability for merchants to notify customers via e-mail on successful orders automatically. Part 2 covers creating shopping carts and making payments via PayPal.
“Create a Web storefront using PHP and PayPal, Part 3”
This series chronicles the building of a Web storefront in PHP using PHP Data Objects to access a Derby database. The storefront includes a user-manageable shopping cart that allows item purchases using PayPal and includes the ability for merchants to notify customers via e-mail on successful orders automatically. This final part covers the addition of transactions, a shipping component, and an e-mail notification feature.
“Create an Amazon storefront using PHP, Part 1”
This is the first of a two-part tutorial that constructs an Amazon storefront using PHP and the Amazon E-Commerce Service (ECS). The storefront allows shoppers to view items displayed in lists or search for specific items in the store.
“Create an Amazon storefront using PHP, Part 2”
This is Part 2 of a two-part tutorial that constructs an Amazon storefront using PHP and the Amazon E-Commerce Service (ECS). Find out how to create a shopping cart, a “browse for similar items” feature, a specialty theme shop, and a collectibles shop.
Extension
PHP ships with many built-in capabilities, but it can also be easily extended. You can take advantage of pre-written PHP components (PEAR), compile existing packaged C extensions (PECL), or write your own.
Find out how to work with libraries written in PHP or extensions written in C.
Sara Golemon provides information on developing custom extensions.
“An introduction to Service Data Objects for PHP”
A team of IBM developers who implemented SDO in PHP rdescribe a real-world example of adding new capability to PHP via a PECL extension. The extension is available for download at the PECL SDO.
Between PHP versions
PHP V5 provides many new features and is largely backward-compatible with PHP V4. However, there are important differences that may affect how your application behaves.
This Zend site introduces PHP V5 and describes what has changed in the newest version.
Get answers to frequently asked questions about migration.
Learn about upgrading to PHP V5. The overview provided is explored in detail in the author’s book.
To IBM database servers
IBM databases offer many features not available in other vendor products.
IBM Redbook: MySQL to DB2 UDB Conversion Guide
DB2 UDB has long been known for its technology leadership. This IBM Redbook is an informative guide that describes how to migrate the database system from MySQL to DB2 UDB V8.1 on Linux and how to convert applications to use DB2 UDB instead of MySQL.
Security
PHP enables you to build functional applications quickly. This can lead to inadequate error handling and input verification. Consider these common pitfalls before deploying your site.
Chances are that at some point, you’ve had a concern about the security of a PHP application. When faced with an auditing task, do you know what to look for? This series walks you through PHP and helps you understand it enough to know what to look for when conducting a security audit. Part 1 walks you through understanding the register_globals setting.
The PHP Security Consortium (PHPSC) is a group of PHP experts who promote best practices for secure PHP development. The PHPSC site contains articles, a PHP security guide, and weekly summaries of PHP security issues.
Pax Dickinson addresses seven common security issues and how to mitigate the risk in your code.
Read this talk given by Chris Shiflett to help you analyze your PHP applications for security holes.
Mailing lists
Mailing lists are an excellent resource for getting answers to your PHP installation and development problems. See if there is already an answer in the archives. If not, ask your question. Many user groups have their own mailing lists.
There are many lists for those interested in PHP. This site includes lists for general and subject-specific topics in PHP development for end users, as well as a few lists for those building the PHP engine itself.
News
PHP gets better every day. Keeping up with what has changed is important.
Read Zend’s weekly summaries of new code, bugs, fixes, patches and talk.
Keep on top of weekly updates that may affect the security of your PHP applications.
Blogs
Peruse this partial list of blogs by core PHP engine developers and PHP application developers. Following trends here will give you a good idea of what to expect in upcoming versions of PHP, as well as what development best practices to keep on top of.
Ilia Alshanetsky is a PHP speaker, and book and article author.
Andi Gutmans is an architect of the Zend Engine and co-founder of Zend Technologies.
Grant Hutchison is a senior product manager at IBM responsible for supporting the application development community for IBM database servers, including DB2 UDB, Cloudscape/Apache Derby, and Informix Dynamic Server (IDS).
John Lim is a PHP developer.
Mike Lively is a PHP developer.
Visit php|architect, written and published by Marco Tabini.
Visit the official blog of PHPDeveloper.org.
See this blog for PHP programming, Web development, PHP advocacy and best practices.
Derick Rethans is a developer of PHP’s mcrypt, date and input-filter extensions, bug fixes, additions among other contributions.
Tobias Schlitt is a PHP developer.
Dan Scott is the release lead for the ibm_db2 and PDO_INFORMIX extensions, among other contributions to PHP.
Chris Shiflett is a PHP consultant, speaker, and book and article author.
SitePoint is a PHP and Web design information site.
David Sklar is a frequent author and speaker on PHP.
Zeev Suraski is an architect of the Zend Engine and co-founder of Zend Technologies.
Jason Sweat is a PHP speaker and book author.
Adam Trachtenberg is a PHP speaker, and book and article author.
Andrei Zmievski, Technical Yahoo at Yahoo!, is a principal developer of PHP.
User groups
User groups are one of the best ways to meet fellow developers in person and regularly hear about current topics from experts.
New York PHP meets at the IBM building in midtown Manhattan on the fourth Tuesday of every month.
The calendar at php.net lists user group meetings for each month.
Log in to contribute to php article.
