Answer the question
In order to leave comments, you need to log in
How to install PHP 5.4 on Nginx on Ubuntu Server 16.04?
There is a project, it is necessary to raise it locally strictly on PHP 5.4
It seems that it turned out to be done from the source along this route:
Download php 5.4.45
Unpack:
tar -xvf php-5.4.45.tar.gz
go to the unpacked
GCC folder:
sudo apt install gcc
execute ./configure
then
sudo make install
Answer the question
In order to leave comments, you need to log in
In short, you can build it like this:
mkdir -p /opt/php-5.4.45
rm -rf /usr/local/src/php5-build && mkdir /usr/local/src/php5 -build
cd /usr/local/src/php5-build
wget de2.php.net/distributions/php-5.4.45.tar.gz
tar -vzxf php-5.4.45.tar.gz && cd php-5.4.45
./configure --prefix=/opt/php-5.4.45 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/ usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization -- with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --enable-zip -- with-pcre-regex --with-mysqli --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable -gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable -ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-fpm
make && make install
cp /usr/local/src/php5-build/php-5.4.45/php.ini-production /opt/php-5.4.45/lib/php.ini
cp /opt/php-5.4.45/etc/php -fpm.conf.default /opt/php-5.4.45/etc/php-fpm.conf
mkdir /opt/php-5.4.45/etc/php-fpm.d
Edit some options in /opt/php-5.4. 45 /etc/php-fpm.conf
include=etc/php-fpm.d/*.conf
[global]
pid = run/php-fpm.pid
log_level = error
Change settings in /opt/php-5.4.45/lib /php.ini to your liking, I have it like this:
date.timezone = "Asia/Yekaterinburg"
expose_php = Off
short_open_tag = On
max_execution_time = 600
max_input_time = 300
max_input_vars = 5000
memory_limit = 512M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
post_max_size = 128M
;default_charset = "UTF-8"
upload_max_filesize = 128M
default_socket_timeout = 120
mysql.connect_timeout = 120
If sysv is used on Linux, create the file /etc/init.d/ php-5.4.45-fpm, see https://gist.github.com/CHERTS/bcf1006e90777ead77c... Assign
permissions and autostart
# chmod 755 /etc/init.d/php-5.4.45-fpm
# insserv - v /etc/init.d/php-5.4.45-fpm
Run:
# /etc/init.d/php-5.4.45-fpm start
If systemd is used on Linux, create file
/lib/systemd/system/php -5.4.45-fpm.service
sourcehttps://gist.github.com/CHERTS/bcf1006e90777ead77c...
If systemd is used on Linux, run:
# chown root:root /lib/systemd/system/php-5.4.45-fpm.service
# systemctl daemon-reload
# systemctl enable php-5.4.45-fpm.service
# systemctl start php-5.4.45-fpm.service
You can check the status with the command
# systemctl status php-5.4.45-fpm.service
Delete
# systemctl stop php-5.4.45-fpm .service
# systemctl disable php-5.4.45-fpm.service
# systemctl daemon-reload
# systemctl reset-failed
# rm /lib/systemd/system/php-5.4.45-fpm.service
# systemctl daemon-reload
Next, in the /opt/php-5.4.45/etc/php-fpm.d/ directory, create a php-fpm pool file with a name, for example, mysite.conf
The contents of mysite.conf, for example, are (mysiteuser and mysitegroup are the names of the system user and group on behalf of which this pull will work, php_admin_value[open_basedir] specifies the path to the root directory of the site, mysiteuser and mysitegroup must have full rights to this directory):
[mysite]
listen = /var/lib/php5-fpm/mysite.sock
listen.owner = mysiteuser
listen.group = mysitegroup
listen.mode = 0660
user = mysiteuser
group = mysitegroup
pm = dynamic
pm.max_children = 8
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 500
chdir = /
php_admin_value[open_basedir] = /var/www/mysite/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin :/var/lib/phpmyadmin
php_admin_value[session.save_path] = /var/www/mysite/tmp
php_admin_value[upload_tmp_dir] = /var/www/mysite/tmp
After restarting
systemctl status php-5.4.45-fpm.service
or
/ etc/init.d/php-5.4.45-fpm restart Specify /var/lib/php5-fpm/mysite.sock as the
php-fpm socket in the nginx settings
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question