Get Social

Building PHP 7.4 with phpbrew on Ubuntu/Debian Server (Vesta CP)

The task was to install PHP 7.4 on an Ubuntu server (it is also possible on Debian). Vesta CP is used to manage my server and I’ll install PHP 7.4.8 via phpbrew.

Phpbrew pre-setup on Ubuntu/Debian server running Vesta CP

1. Go to /root directory

cd /root

2. Let’s prepare phpbrew for compilation. We will put in an alternative php directory: /usr/local/php

phpbrew init --root=/usr/local/php
  
export PHPBREW_ROOT=/usr/local/php

[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc

phpbrew update

3. BUT! First time I tried to build PHP 7.4, I got an error.

Phpbrew build error on Vesta (Debian/Ubuntu) – “No package oniguruma found” (pkg-config)

How to overcome this error?

First, we’ll find and install required, “oniguruma” containing package to satisfy the dependency:

# apt search oniguruma
Sorting... Done
Full Text Search... Done
libjruby-joni-java/oldstable,oldstable 2.1.11-2 all
 Java port of Oniguruma regexp library

libonig-dev/oldstable,oldstable,now 6.1.3-2 amd64 [installed]
 regular expressions library — development files

libonig4/oldstable,oldstable,now 6.1.3-2 amd64 [installed,automatic]
 regular expressions library

libonig4-dbg/oldstable,oldstable 6.1.3-2 amd64
 regular expressions library — debugging symbols

lua-rex-onig/oldstable,oldstable 2.7.2-4 amd64
 Onig regular expressions library for the Lua language

Setup via command:

apt install libonig-dev

Then we’ll edit the build command, taking into account what is written on GitHub:

Here is the complete build command:

phpbrew install 7.4 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg=/usr --with-freetype=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --enable-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml --enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

At the end, we’ll create a symbolic link in order to set up later in Vesta CP configuration:

ln -s /usr/local/php/php/php-7.4.8 /usr/local/php/php74

Why Sphinx does not work on Ubuntu / Debian?

If the sphinx service is started, but the search on the site does not produce anything (and an no error), the problem can be as follows:
systemctl status sphinxsearch
When checking the status of the service – pay attention to the line

...
... To enable sphinxsearch, edit /etc/default/sphinxsearch and set START=yes
...

In this case, just edit the file / etc / default / sphinxsearch and change the value of the parameter “START = no” to “START = yes”.
It’s all!

Error: mod_fcgid: HTTP request length 137536 (so far) exceeds MaxRequestLen (131072)

mod_fcgid: HTTP request length 137536 (so far) exceeds MaxRequestLen (131072)

After installing the panel ISPmanager Lite 5.126.2 with a trial license for 2 weeks (this is convenient, since during this time you can safely buy and activate the license), I ran into this error. In this case, php is configured in FastCGI mode .

When I try to start a web application, I get (in logs or in debug):

mod_fcgid: HTTP request length 132992 (so far) exceeds MaxRequestLen (131072), referer: http...

In the browser you can get a little informative message:

Error 500, Internal server error

Let’s return to the logs:

The 1st figure is always different and depends on the request from your application

The 2nd figure is 131072 – this is the default MaxRequestLen .

HTTP request request length 132992 (so far) exceeds MaxRequestLen (131072) indicates that your request has exceeded the default value

Hence decision will – increase this parameter.

Of course, you can insert it almost anywhere in the apache config file. It is possible in the settings of your host.

But best edit the configuration of the FastCGI module itself:

/etc/apache2/mods-available/fcgid.conf (if you have Debian, Ubuntu and their other derivatives)
/etc/httpd/conf.d/fcgid.conf (if you have CentOS, Fedora and the like)

To select the appropriate value for the MaxRequestLen parameter, look at your php.ini

upload_max_filesize = 2M

For this value, it is suitable: 2M = 2097152 bytes. Add it to your fcgid.conf file:

FcgidMaxRequestLen 2097152

After that restart apache:

apachectl restart

 

Pages:12345