PHP

提供: Amayus Wiki
Jump to navigation Jump to search

PHP エラー覚書[編集]

まあエラーに書いてある通りなんだけど、サンプルコードと一緒に載せておきたい

Warning: illegal offset type in FILE on line N
配列のキーに配列やクラスを指定した場合
Warning: array_key_exists(): The first argument should be either a string or an integer in FILE on line N
array_key_exists 関数の第一引数に配列やクラスを指定した場合

Require[編集]

Install[編集]

libxml[編集]

$ sudo yum install python-devel
$ wget ftp://xmlsoft.org/libxml2/libxml2-2.9.8.tar.gz
$ tar xf libxml2-2.9.8.tar.gz
$ cd libxml2-2.9.8
$ ./configure --prefix=/opt/libxml2-2.9.8
$ make -j2
$ make check
$ sudo make install
$ cd /opt && sudo ln -Tsf libxml2-2.9.8 libxml2 && cd -
$ cd ..

libjpeg[編集]

$ wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
$ tar xf jpegsrc.v9c.tar.gz
$ cd jpeg-9c
$ ./configure --prefix=/opt/libjpeg-9c
$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf libjpeg-9c libjpeg && cd -
$ cd ..

libpng[編集]

$ wget https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
$ tar xf libpng-1.6.37.tar.gz
$ cd libpng-1.6.37
$ CPPFLAGS="-I/opt/zlib/include" LDFLAGS="-L/opt/zlib/lib" ./configure --prefix=/opt/libpng-1.6.37
$ make -j2
$ LD_LIBRARY_PATH=/opt/zlib/lib make test
$ sudo make install
$ cd /opt && sudo ln -Tsf libpng-1.6.37 libpng && cd -
$ cd ..

libwebp[編集]

$ sudo apt install autoconf libtool
$ wget --no-check-certificate -O libwebp-1.0.2.tar.gz https://github.com/webmproject/libwebp/archive/v1.0.2.tar.gz
$ tar xf libwebp-1.0.2.tar.gz
$ cd libwebp-1.0.2
$ ./autogen.sh
$ ./configure --prefix=/opt/libwebp-1.0.2
$ make -j2
$ make check
$ sudo make install
$ cd /opt && sudo ln -Tsf libwebp-1.0.2 libwebp && cd -
$ cd ..

curl[編集]

$ wget https://curl.haxx.se/download/curl-7.64.0.tar.gz
$ tar xf curl-7.64.0.tar.gz
$ cd curl-7.64.0
$ ./configure --prefix=/opt/curl-7.64.0 --with-ssl=/opt/openssl --with-zlib=/opt/zlib
$ ./configure --prefix=/opt/curl-7.64.0 --with-ssl=/opt/openssl --with-nghttp2=/opt/nghttp2 --with-zlib=/opt/zlib # nghttp2が見つからない?
$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf curl-7.64.0 curl && cd -
$ cd ..

ICU[編集]

$ wget -O icu-release-64-2.tar.gz https://github.com/unicode-org/icu/archive/release-64-2.tar.gz
$ tar xf icu-release-64-2.tar.gz
$ cd icu-release-64-2/icu4c/source
$ ./configure --prefix=/opt/icu-release-64-2
$ make -j2
$ make check
$ sudo make install
$ cd /opt && sudo ln -Tsf icu-release-64-2 icu && cd -
$ cd ../../..

PHP[編集]

$ wget -O php-7.3.5.tar.gz http://jp2.php.net/get/php-7.3.5.tar.gz/from/this/mirror
$ tar xf php-7.3.5.tar.gz
$ cd php-7.3.5

$ ./configure --prefix=/opt/php-7.3.5 \
--with-libxml-dir=/opt/libxml2 \
--with-apxs2=/opt/httpd/bin/apxs \
--with-gd \
--with-jpeg-dir=/opt/libjpeg \
--with-png-dir=/opt/libpng \
--with-webp-dir=/opt/libwebp \
--with-zlib-dir=/opt/zlib \
--with-curl=/opt/curl \
--with-icu-dir=/opt/icu \
--with-openssl=/opt/openssl \
--with-mysqli \
--enable-maintainer-zts \
--enable-mbstring \
--enable-mysqlnd \
--enable-pdo \
--enable-fpm \
--enable-json \
--enable-fileinfo \
--enable-intl \
--enable-opcache \
--enable-sockets

$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf php-7.3.5 php && cd -
$ cd ..