기본 콘텐츠로 건너뛰기

Nginx + PHP + MySQL 개발 및 배포 환경 구축 (4)

Windows 10 64bit 환경에서 PHP 7.2 설치하기

목차로 돌아가기

1. PHP 7.2 설치하기

VC15 x64 Non Thread Safe 내려받아 D:\Utils 폴더에 압축을 푼다.

D:\Utils\php-7.2.7-nts-Win32-VC15-x64 >

PHP-FPM 설정을 위해 php.ini 설정파일을 편집한다. php.ini 파일은 C\Windows 폴더에 기본적으로 위치한다. PHP FastCGI Process Manager (FPM)은 로드가 많은 사이트에 유용한 설정으로 앞서 설치한 nginx와 함께 사용할 수 있도록 nginx 설정 파일도 함께 편집한다.

;C:\Windows\php.ini

engine = Off

memory_limit = 1G

extension_dir = "ext" ; for windows

cgi.force_redirect = 0
cgi.fix_pathinfo=0

; PHP 7.2 이전 버전
; extension=php_extname
; PHP 7.2 부터 확장 모듈명만 기재
; extenstion=extname
extension=curl
extension=gd2
extention=mbstring
extention=exif
extention=mysqli

; php_oci8_12c.dll은 Oracle C interface의 일부이므로 Oracle instant client가 설치되어 있어야 한다.
extention=oci8_12c

extention=openssl

[Date]
date.timezone = Asia/Seoul

2. php-cgi.exe 실행

D:\Utlis\php-7.2.7-nts-Win32-VC15-x64> php-cgi.exe -b 127.0.0.1:9000

3. nginx.conf 설정

location ~ \.php$ {
  root           html;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  include        fastcgi.conf 
  #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  #include        fastcgi_params;
}

4. PEAR 패키지 관리자 설치하기

PHP를 다운받아 설치한 후, 웹브라우저에서 https://pear.php.net/go-pear.phar를 다운로드받아서 go-pear.phar라는 파일을 PHP 설치 폴더에 저장하여 실행한다. C:\Windows 폴더 내에 pear.ini를 복사하고 php.ini를 편집하는 과정이 진행되므로 관리자 권한으로 명령프롬프트를 실행하여 진행한다.

D:\Utlis\php-7.2.7-nts-Win32-VC15-x64>php go-pear.phar [ENTER]
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : [ENTER]

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix)                   : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64
2. Temporary directory for processing            : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\tmp
3. Temporary directory for downloads             : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\tmp
4. Binaries directory                            : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64
5. PHP code directory ($php_dir)                 : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\pear
6. Documentation directory                       : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\docs
7. Data directory                                : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\data
8. User-modifiable configuration files directory : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\cfg
9. Public Web Files directory                    : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\www
10. System manual pages directory                 : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\man
11. Tests directory                               : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\tests
12. Name of configuration file                    : C:\Windows\pear.ini
13. Path to CLI php.exe                           : D:\Utlis\php-7.2.7-nts-Win32-VC15-x86

1-13, 'all' or Enter to continue: [ENTER]
Beginning install...
Configuration written to C:\Windows\pear.ini...
Initialized registry...
Preparing to install...
installing phar://D:/Utlis/php-7.2.7-nts-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.3.tar...
installing phar://D:/Utlis/php-7.2.7-nts-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar...
installing phar://D:/Utlis/php-7.2.7-nts-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.5.tar...
installing phar://D:/Utlis/php-7.2.7-nts-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar://D:/Utlis/php-7.2.7-nts-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.2.tar...
install ok: channel://pear.php.net/Archive_Tar-1.4.3
install ok: channel://pear.php.net/Console_Getopt-1.4.1
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.4.2
install ok: channel://pear.php.net/PEAR-1.10.5
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR''s PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<D:\Utils\php-7.2.7-nts-win32-vc15-x64\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <C:\Windows=php.ini>? [Y/n] : [ENTER]

php.ini <C:\Windows=php.ini> include_path updated.

Current include path           : .;C:\php\pear
Configured directory           : D:\Utlis\php-7.2.7-nts-Win32-VC15-x64\pear
Currently used php.ini (guess) : C:\Windows\php.ini
Press Enter to continue:

** WARNING! Old version found at D:\Utlis\php-7.2.7-nts-Win32-VC15-x64, please remove it or be sure to use the new d:\utlis\php-7.2.7-nts-win32-vc15-x64\pear.bat command

The 'pear' command is now at your service at d:\utlis\php-7.2.7-nts-win32-vc15-x64\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use 'd:\utlis\php-7.2.7-nts-win32-vc15-x64\pear.bat' until you have added
** 'D:\Utlis\php-7.2.7-nts-Win32-VC15-x64' to your PATH environment variable.

Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.

For more information about PEAR, see:

http://pear.php.net/faq.php
http://pear.php.net/manual/

Thanks for using go-pear!



* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under D:\Utlis\php-7.2.7-nts-Win32-VC15-x64PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.

댓글

이 블로그의 인기 게시물

NodeMCU에서 I2C 통신을 이용하여 OLED 디스플레이에 표시하기

준비물: NodeMCU 개발보드 1개, OLED SSD1306 디스플레이 1개, micro-USB 케이블 1개, 브레스보드 그림 1. 준비물 개발환경 아두이노 스케치 1.8.9 Wire 라이브러리 https://www.arduino.cc/en/reference/wire ESP8266 OLED SSD1306 라이브러리    https://github.com/ThingPulse/esp8266-oled-ssd1306 I2C란 I2C 버스는 80년대 초반에 저속의 부품들을 연결하기 위한 목적으로 필립스에서 개발한 직렬버스이다. "Inter IC"라고도 하며, IIC, I2C 버스라고도 한다. I2C 통신은 다음과 같은 특징들을 갖는다. SDA, SCL 등 2개의 통신선만 사용하므로 구성이 간단하다. 마스터-슬레이브 관계로 연결하여 1:n 연결이 가능하다. 슬레이브는 고유의 주소로 구분한다. 통신 최대속도는 100Kbit/s이며, Fast mode(400Kbit/s), High speed mode(3.4Mbit/s)도 지원한다. 실습내용 아두이노의 경우 디폴트로 SDA와 SCL을 위해 GPIO4 핀과 GPIO5 핀이 지정되어 있지만, ESP8266의 경우 소프트웨어적인 방식으로 구현되어 있기 때문에 임의의 핀을 이용할 수 있다. 여기서는 D1(GPIO5), D2(GPIO4)핀을 SCL과 SDA로 지정했다. ESP8266은 마스터로 동작하며 OLED 디스플레이는 슬레이브로 동작한다. Wire 라이브러리 ESP8266(마스터)에서 OLED 디스플레이(슬레이브)로의 데이터 전송은 먼저 버퍼를 준비하고, 버퍼에 데이터를 기록한 후 버퍼의 내용을 전달하는 3단계로 진행된다. 멤버 함수들을 사용하기 위해 우선 헤더 파일을 추가한다. #include <Wire.h> 초기화 void begin(int sda, int scl) sda: SDA(Serial data) 핀 번호 scl: SCL(Serial clock) 핀 번호 데이터...

ESP8266 마이크로컨트롤러에서 UART0과 UART2 동시 사용하기

ESP-12F와 2개의 FTDI를 UART0과 UART2에 연결 ESP8266은 3개의 UART 포트를 제공한다. UART0과 UART2는 같은 Serial 클래스에서 관리하므로 동시 사용이 불가능하므로 교대로 사용해야 한다. UART1은 Serial1 클래스에서 관리하므로 동시 사용이 가능하지만 출력 전용이기 때문에 TX만 정의되어 있다. UART0 UART1 UART2 RX GPIO3(RX) - GPIO13 TX GPIO1(TX) GPIO2 GPIO15 아두이노 클래스 Serial Serial1 Serial 비고 UART2와 동일한 클래스를 통해 관리됨 메시지 수신을 위한 RX는 정의되어 있지 않음 UART0와 동일한 클래스를 통해 관리됨 UART0과 UART2는 동시 사용이 불가능하므로 한 번에 하나의 포트만 사용하도록 Serial 클래스의 swap() 멤버함수를 사용한다. NodeMCU와 USB-UART 연결 NodeMCU는 ESP-12E 개발보드가 사용되었으며, micro-USB 포트를 제공한다. micro-USB 포트는 UART0 포트를 사용하며, RX(GPIO3)와 TX(GPIO1) 핀을 공유한다. USB-UART 연결 장치를 UART2 포트에 연결하기 위해 D7(GPIO13)과 D8(GPIO15) 핀에 연결했다. NodeMCU는 UART0 포트를 이용하여 Ardino의 시리얼 모니터로 출력을 보내며, UART2 포트의 출력은 별도의 터미널프로그램으로 접속하여 출력을 모니터했다.

자작 :: 아두이노 온습도계

사용부품: Arduino UNO 호환보드, DH-22 온습도 센서, 캐릭터 LCD(16x2글자), Potentionmeter 아두이노 온습도계 AM2302 DH-22 온습도센서는 다음과 같이 3개의 핀을 사용한다. Pin 1. Vcc (전원 3.3~ 5.5V) Pin 2. GND (접지) Pin 3. DOUT (데이터 송신, SDA핀 연결) 온습도 센서의 데이터 수신을 위해 DOUT 핀은 아두이노의 D2 핀에 연결했고, 전원과 DOUT을 10㏀ 풀업 저항을 달아 연결했다. 부품 구성도 LCD는 웹사이트의 카달로그로 보기에는 백색 LED 백라이트가 멋있게 보여 구매를 했는데, 가독성면에서는 옐로우-그린 LED가 더 나을 것 같기도 하다. 아두이도는 기본적으로 LCD의 D4 ~ D7까지의 핀으로 4bit 통신을 한다. D2 핀은 밝기 조절을 위해 가변저항의 가운데 핀과 연결했다. 백라이트 전원은 220Ω 저항을 달았다. 온습도 정보를 수집하여 LCD에 출력하기 위한 아두이노 소스는 다음과 같다. 소스코드:  https://github.com/Jeongsam/arduino-DH22-LCD1602 #include <adafruit_sensor.h=""> #include <liquidcrystal.h=""> #include <dht.h=""> #include <dht_u.h=""> /** * 현재 온습도를 디스플레이하기 * DHT22(AMS2302)로부터 데이터를 받아 LCD16x2 디스플레이에 표시 */ // 온습도 센서 설정 #define DHTPIN 2 // 온습도 데이터 연결 핀 번호 #define DHTTYPE DHT22 // AMS2302 DHT_Unified dht(DHTPIN, DHTTYPE); uint32_t d...