How to deploy zend1 framework inside a docker container?

Viewed 20

I want to deploy the php zend1 framework app inside a container.

After following the guide link I used the the docker-compose.yml for tmy Webserver. Moreover I used composer as a shardj/zf1-future to install the requirements

I assume there is an issue with finding the zend framework since I get

Warning: require_once(Zend/Application.php): Failed to open stream: No such file or directory in /var/www/html/index.php on line 18

Fatal error: Uncaught Error: Failed opening required 'Zend/Application.php' (include_path=':.:/usr/local/lib/php') in /var/www/html/index.php:18 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 18

% cat quickstart/public/index.php 
-------
<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();%   

quickstart
├── application
│   ├── Bootstrap.php
│   ├── configs
│   │   └── application.ini
│   ├── controllers
│   │   ├── ErrorController.php
│   │   └── IndexController.php
│   ├── models
│   └── views
│       ├── helpers
│       └── scripts
│           ├── error
│           │   └── error.phtml
│           └── index
│               └── index.phtml
├── docs
│   └── README.txt
├── library
│   ├── Zend -> ../../vendor/shardj/zf1-future
│   └── zf1-future -> ../../vendor/shardj/zf1-future
├── public
│   └── index.php
└── tests
    ├── application
    │   └── controllers
    │       └── IndexControllerTest.php
    ├── bootstrap.php
    ├── library
    └── phpunit.xml
docker-compose.yml
-----
version: "3.9"

services:
    web:
        image: nginx:latest
        ports:
            - "8080:80"
        volumes:
            - ./quickstart/public:/var/www/html
            - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
        links:
            - php-fpm
    php-fpm:
        image: php:8-fpm
        volumes:
            - ./quickstart/public:/var/www/html
% cat docker/nginx/default.conf 
server {
    index index.php index.html;
    server_name phpfpm.local;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/html;
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php-fpm:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
 % tree -L 2
.
├── compoesr_deloy.md
├── composer.json
├── composer.lock
├── docker
│   └── nginx
├── docker-compose.yml
├── quickstart
│   ├── application
│   ├── docs
│   ├── library
│   ├── public
│   └── tests
├── README.md
└── vendor
    ├── autoload.php
    ├── bin
    ├── composer
    ├── shardj
    └── symfony
0 Answers
Related