PHP

Материал из First-Leon
Перейти к: навигация, поиск

Установка PHP из PPA

apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update

Установка Composer

/usr/local/bin
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Сборка

Ubuntu 14.04 Php 5.4

apt-get install make gcc libxml2-dev build-essential checkinstall zip libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev zlib1g-dev libbz2-dev libjpeg-dev libpng16-dev libpng-dev libfreetype6-dev libc-client2007e-dev libkrb5-dev libmcrypt-dev libpspell-dev apache2-dev libicu-dev
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a


wget -O php-5.4.45.tar.bz2 http://fi2.php.net/get/php-5.4.45.tar.bz2/from/this/mirror
tar -xf php-5.4.45.tar.bz2 
cd php-5.4.45

 ./configure \
--prefix=/opt/php/5.4.12 \
--with-zlib-dir \
--with-freetype-dir \
--enable-cgi \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-libdir=lib64 \
--with-libxml-dir=/usr \
--enable-exif \
--enable-dba \
--with-gettext \
--enable-shmop \
--enable-sysvmsg \
--enable-wddx \
--with-kerberos \
--enable-bcmath \
--enable-ftp \
--enable-intl \
--with-pspell \
--with-apxs2
#--with-imap \
#--with-imap-ssl \
checkinstall -D make install

Добавить строку в /etc/apache2/mods-enabled/php5.load

AddType application/x-httpd-php .php
a2dismod mpm_event
a2enmod mpm_prefork
service apache2 restart

Ubuntu 12.04 Php 5.3

apt-get install make gcc libxml2-dev build-essential checkinstall zip libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev zlib1g-dev libbz2-dev libjpeg-dev libpng12-dev libpng-dev libfreetype6-dev libc-client2007e-dev libkrb5-dev libmcrypt-dev libpspell-dev apache2-dev libicu-dev
#ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
mkdir /usr/include/freetype2/freetype
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h
wget -O php-5.3.29.tar.bz2 http://at1.php.net/get/php-5.3.29.tar.bz2/from/this/mirror
tar -xf php-5.3.29.tar.bz2
cd php-5.3.29
 ./configure \
--prefix=/opt/php/5.4.12 \
--with-zlib-dir \
--with-freetype-dir \
--enable-cgi \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-libdir=lib64 \
--with-libxml-dir=/usr \
--enable-exif \
--enable-dba \
--with-gettext \
--enable-shmop \
--enable-sysvmsg \
--enable-wddx \
--with-kerberos \
--enable-bcmath \
--enable-ftp \
--enable-intl \
--with-pspell \
--with-apxs2
#--with-imap \
#--with-imap-ssl \
checkinstall -D make install

Добавить строку в /etc/apache2/mods-enabled/php5.load

AddType application/x-httpd-php .php


a2dismod mpm_event
a2enmod mpm_prefork
service apache2 restart

Отладка php-fpm

socat -v UNIX-LISTEN:/tmp/php7.1-fpm.sock UNIX-CONNECT:/var/run/php/php7.1-fpm.sock

Ссылки