At a Glance
This chapter covers installing Zend Framework 1 via PEAR, manual download, and include path configuration. It also addresses Composer-based approaches for modern environments and explains the autoloading setup that the rest of the book depends on.
What Changed Since Zend Framework 1
PEAR-based installation is effectively obsolete. Modern PHP projects use Composer for dependency management with PSR-4 autoloading. If you are setting up a legacy ZF1 project, Composer can still manage ZF1 packages through custom repositories. For new work, Laminas packages are installed directly via Composer. The PHP installation documentation remains the authoritative reference for getting PHP itself configured correctly.
Getting a framework installed sounds straightforward until you actually do it on a machine that has its own opinions about PHP versions, include paths, and extension availability. In this chapter, I walk through the installation methods for Zend Framework 1, covering PEAR-based installation, manual setup, include path configuration, and the autoloading mechanism that everything else in the book depends on. The guidance here comes from setting up ZF1 on dozens of different environments, from shared hosting to local development stacks to dedicated servers.
For the overall book structure, see the Zend Framework Book hub.
Installation Methods
Zend Framework 1 could be installed through several paths. The right choice depended on your environment, your team’s workflow, and how much of the framework you intended to use.
PEAR Installation
PEAR was the standard PHP package manager before Composer existed. Installing ZF1 via PEAR looked like this:
1 | pear channel-discover zend.googlecode.com/svn |
The PEAR approach handled version management and made the framework available system-wide through the PHP include path. The drawback was that PEAR installations were global, which meant different projects on the same machine could not easily use different framework versions.
Manual Installation
The manual approach involved downloading the framework archive, extracting it, and placing the library/Zend directory somewhere accessible to your PHP include path.
1 | // In your bootstrap or entry script |
This was the most common approach for production deployments because it gave you explicit control over exactly which version of the framework was running. No surprises from a system-wide update breaking things on a Friday afternoon.
Composer (Modern Alternative)
For environments that need to run ZF1 today, Composer provides a cleaner dependency management path:
1 | { |
Running composer install pulls the framework into a vendor directory with PSR-0 compatible autoloading handled automatically. This eliminates the include path juggling that was a constant source of configuration headaches in the original setup.
Configuring the Include Path
Before Composer’s autoloader became standard, PHP’s include path was the mechanism for locating class files. The include path is an ordered list of directories that PHP searches when it encounters a require or include statement, or when the autoloader tries to resolve a class name to a file.
A typical ZF1 include path configuration looked like:
1 | set_include_path(implode(PATH_SEPARATOR, array( |
Getting the include path wrong was one of the most common early frustrations with ZF1 projects. The symptoms were usually fatal errors about classes not being found, and the root cause was almost always a path that did not resolve to where the framework files actually lived on disk.
Autoloading
Zend Framework 1 included its own autoloader, Zend_Loader_Autoloader, which registered with PHP’s spl_autoload mechanism to automatically load classes based on their name and the include path.
1 | require_once 'Zend/Loader/Autoloader.php'; |
The autoloader followed PEAR naming conventions: a class named Zend_Controller_Front mapped to the file path Zend/Controller/Front.php. This was predictable and consistent, even if the underscore-to-directory mapping feels clunky compared to modern PSR-4 namespace-based autoloading.
For application-specific classes, you could register additional autoload namespaces:
1 | $autoloader->registerNamespace('My_'); |
This told the autoloader to look for classes starting with My_ using the same PEAR naming convention, searching through the include path for matching files.
Verifying the Installation
After installation, a quick verification script confirms everything is wired up:
1 |
|
If this outputs the framework version number without errors, the include path and autoloading are configured correctly. If you get a file-not-found error, the include path is the first place to check.
Common Installation Problems
Class Not Found Errors
Almost always an include path issue. Verify that the path to the Zend directory is correct and that PHP can actually read the files. On shared hosting, permissions can be an unexpected obstacle.
Version Conflicts
If PEAR was used for a system-wide installation and a project also has a local copy, the include path order determines which version PHP finds first. The local copy should appear before the system path to ensure the project uses its own version.
Extension Dependencies
Some ZF1 components depend on PHP extensions that may not be enabled by default. Zend_Db needs the appropriate database driver extension, Zend_Cache may need APC or Memcached extensions, and Zend_Soap requires the SOAP extension. Check php -m to see which extensions are available.
Frequently Asked Questions
Can I still install Zend Framework 1 via PEAR in 2025?
Technically you can if PEAR is available, but the PEAR channels for ZF1 are no longer actively maintained. Composer is the practical choice for managing ZF1 dependencies in current environments.
What PHP version does Zend Framework 1 require?
ZF1 requires PHP 5.2.11 or later. The final 1.12.x releases work with PHP 5.6 and PHP 7.x with some deprecation notices. PHP 8.x compatibility requires community patches or the use of maintained forks.
Should I use the full framework or individual components?
That depends on the project. If you are building a full MVC application, the complete framework makes sense. If you just need specific functionality like mail handling or PDF generation, individual components can be used standalone with minimal overhead.
How does this compare to installing Laminas?
Laminas packages are installed entirely through Composer with PSR-4 autoloading. The installation process is cleaner and more aligned with modern PHP workflows. The migration guide covers the differences in detail.
Related Reading
- A Not So Simple Hello World Tutorial to start building with the installed framework
- Standardise the Bootstrap for configuration and initialisation
- Local Development Environments for modern setup options
- PHP Topic Hub for broader PHP coverage