기본 콘텐츠로 건너뛰기

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.

댓글

이 블로그의 인기 게시물

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 포트의 출력은 별도의 터미널프로그램으로 접속하여 출력을 모니터했다.

아두이노 미세먼지 센서 PM2008

온습도계를 달아봤으니 이참에 미세먼지까지 한꺼번에 표시되도록 기능을 추가해보기로 했다. 마침 아두이노 전용 쉴드까지 제공하는 미세먼지 센서가 눈에 띄길래 일단 구매를 해봤다. 배송받은 센서는 거의 완제품에 가깝게 제작되었다. 다만 아쉬운 점은 아두이노 전용 쉴드의 마감이 좀 지분하다는 느낌을 받았는데, 후처리에 신경을 더 써주는 센스가 부족한 듯. PC2008 미세먼지 센서 아두이노 우노 전용 PM2008 쉴드  부착한 상태는 핀 위치도 잘 맞고 비교적 깔끔한 느낌이다. 쉴드 덕분에 지저분한 배선이 줄어들어 다른 센서들을 붙이기에도 좋을 것 같다. 쉴드와 일체형으로 제작하지 않은 건 라즈베리 파이와 같은 다른 마이크로칩 보드용의 쉴드 제작을 염두에 둔 듯하다. Arduino UNO에 장착한 모습 센서의 작동 테스트를 위해 PM2008 I2C 라이브러리를 추가하여 샘플코드를 실행시켜봤다. 성공적을 테스트를 완료. 이제 공부가 남았을 뿐. Arduino library PM2008 I2C 설치

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

사용부품: 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...