[Zabbix+Grafana]シリーズその2:PHP実装


#PHP 1、https://www.php.net/downloads.php
インストール依存ライブラリ2、``yum-y install epel-releaseyum-y install gcc gcc-c++make pcre-devellibzip libzip-devel zlib zlib-devel openssl-devellibxml 2-devellibcurllibcurl-devellibjpelibjpelibjpeg-devellibpng libpng-devel freetype freetype-devel open開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発開発bmcrypt libmcrypt-devel

#    

3、./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-ctype --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-freetype-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fpm --with-jpeg-dir --with-png-dir
echo $?make && make install

        #    
          1:checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
         :----------
    yum remove -y libzip #      
    #      
    wget https://nih.at/libzip/libzip-1.2.0.tar.gz
    tar -zxvf libzip-1.2.0.tar.gz
    cd libzip-1.2.0
    ./configure

        make && make install

          2:configure: error: off_t undefined; check your library configuration
          :----------

vim/etc/ld.so.conf#次の行を追加/usr/local/lib 64/usr/local/lib/usr/lib/usr/lib 64#保存終了:wqldconfig-v#を有効にします.

          3:/usr/local/include/zip.h:59:21:     :zipconf.h    make: *** [ext/zip/php_zip.lo]    1
          :-------
    cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

#       systemctl
4、vim /etc/profile
export PATH=$PATH:/usr/local/php/sbin:/usr/local/php/bin

vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin:/sur/local/php/bin
[install]
WantedBy=multi-user.target

systemctl daemon-reload , systemd 。


#  

5、sytemctl start php-fpm


#  PHP nginx  ,    nginx.conf

6、vim nginx.conf
index.php
index index.html index.htm index.php;

location ~ .php$ {
root /data/nginx/web;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# /scripts $document_root

# :
vim 1.php
phpinfo();
?>