5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dockerを使ったZend Framework1系の環境構築

Last updated at Posted at 2020-06-19

ディレクトリ構成

--

/html/ここにzend1を解凍する
/mysql
./docker-compose.ymlなど

--

ダウンロードしたzend1を解凍し、こちらのサイトを参考にディレクトリを整えました。
大変参考になり助けてもらいました。

Zendがバージョン1と2(zf2)でぜんぜん違い、初期画面を出すにも大変な件 - ウィリアムのいたずらの開発?日記

2020年現在においてzend1をDockerで環境構築する情報が少なく、いろいろ試行錯誤しました。
そのファイル内容などを書きました。

注意

Zend Framework1のサポートは切れていますので、ご注意ください。

準備するファイルたち

docker-compose.yml
version: "3"

services:
  php:
    build: .
    volumes:
      - "./php.ini:/usr/local/etc/php/php.ini"
      - "./html:/var/www/html"
      - "./000-default.conf:/etc/apache2/sites-available/000-default.conf"
      - "./.htaccess:/var/www/html.htaccess"
    ports:
      - 8080:80
    tty: true
  mysql:
    image: mysql:5.7
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=test
      - MYSQL_USER=test
      - MYSQL_PASSWORD=test
FROM php:5.6-apache

RUN apt-get update
RUN apt-get install -y vim default-mysql-client
RUN docker-php-ext-install pdo_mysql
php.ini
[Date]
date.timezone = "Asia/Tokyo"
[mbstring]
mbstring.internal_encoding = "UTF-8"
mbstring.language = "Japanese"

; UNIX: "/path1:/path2"
include_path = ".:/var/www/html/library"

extension=php_pdo.dll
extension=php_pdo_mysql.dll
000-default.conf
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf

    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^api/(.*)$ index.php
</IfModule>

Apacheのmod_rewriteの設定がよくわからずつまりました。

docker-compose up -d
docker-compose exec php a2enmod rewrite
docker-compose exec php service apache2 restart
docker-compose restart

参考サイト

Manual - Documentation - Zend Framework

超絶簡単!?Zend Framework 1.xインストール方法 - Qiita

Dockerを使ってLaravel開発環境構築(Apache) - Qiita

Apacheのmod_rewrite設定メモ - Qiita

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?