You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Ubuntu 16.04上安装Zend Framework 1.12?指定版本安装方案

Got it, let's get Zend Framework 1.12 installed on your Ubuntu 16.04 system. The default apt-get command pulls the latest version because old 1.12 builds aren't hosted in the official Ubuntu repos anymore. Here are two reliable methods to install the specific version you need:

Composer is the standard dependency manager for PHP projects, and it's the easiest way to grab exact versions of Zend Framework 1.x.

  • First, install Composer if you don't have it already:

    sudo apt-get update
    sudo apt-get install composer php-cli php-mbstring git unzip
    
  • Install Zend Framework 1.12:

    • For a new project, run this command to create a project directory with ZF1.12 pre-installed:
      composer create-project zendframework/zendframework1:1.12.* my-zf-project
      
    • For an existing project, create a composer.json file in your project root (if it doesn't exist) with this content:
      {
          "require": {
              "zendframework/zendframework1": "1.12.*"
          }
      }
      
      Then run:
      composer install
      
    • To use ZF1 in your code, just include the autoloader:
      require_once 'vendor/autoload.php';
      

Note: Zend Framework 1.12 has limited compatibility with PHP 7 (the default PHP version on Ubuntu 16.04). If you hit compatibility issues, you can use a community-maintained PHP7-compatible branch by changing the Composer requirement to zendframework/zendframework1:dev-php7.

Method 2: Manual Download & Installation

If you prefer not to use Composer, you can manually set up ZF1.12:

  • Download the latest stable release of Zend Framework 1.12 (1.12.20 is the final build in this branch) from the official Zend archives, then use wget to pull it to your server (replace the placeholder with the actual download link):

    wget [Zend Framework 1.12.x tar.gz download link]
    
  • Extract the archive to a system-wide PHP library directory, like /usr/share/php:

    sudo tar xzf ZendFramework-1.12.20.tar.gz -C /usr/share/php
    sudo ln -s /usr/share/php/ZendFramework-1.12.20/library/Zend /usr/share/php/Zend
    
  • Update your PHP include path to recognize the ZF1 library:

    • For Apache, edit /etc/php/7.0/apache2/php.ini; for CLI PHP, edit /etc/php/7.0/cli/php.ini.
    • Find the include_path line and modify it to:
      include_path = ".:/usr/share/php/Zend"
      
    • Restart Apache if you're using a web server:
      sudo service apache2 restart
      
  • Verify the installation by creating a test PHP file (e.g., test_zf.php):

    <?php
    require_once 'Zend/Version.php';
    echo Zend_Version::VERSION;
    ?>
    

    Run it with php test_zf.php — if it outputs 1.12.20, you're good to go.

内容的提问来源于stack exchange,提问作者MrGohut

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:01:05