N
N
Nikita Kit2016-10-13 14:55:58
linux
Nikita Kit, 2016-10-13 14:55:58

Where to find and how to install PHP 5.4 on Ubuntu 16.04?

Hello guys, I really need help. The site was transferred from the centOS server (php 5.4) to the Ubuntu locale. The oldest version available in turnips - php5.6 - I installed it, but the site does not want to start normally. Basically, the reason for the failures in data processing is the same - "the method of shud notes bi sold statics" - well, you understand. The site is large (5 gigs, not counting the cache), on Bitrix. scripts download components from different parts of the web server. Such errors are very common and constantly climbing into the source code and putting @ in front of an unexecuted method is already tired.
In php 5.4 there are no such errors and everything plows the rules, but I can’t put it in any way. Already searched the whole Google.
The oldest turnip I found https://launchpad.net/~ondrej/+archive/ubuntu/php5..., but even after adding it and updating it, the apt writes to me "No candidate for installation was found for the package "php5""
The package was assembled and installed from php.net, it was installed in usr/local/lib/php, although the versions that I put through apt, fell in etc / php.
php -v gives me 5.4.45 , and phpinfo() - 5.6 Tell me
how to change the php version in Apache (2.4)? Tried restarting it - no change.
Thank you all in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
romeOz, 2016-10-20
@ShadowOfCasper

Of course, you can get confused and build PHP from source. In addition, you will have to build Apache from source with the addition of the PHP module (libapache2-mod-php).
Unfortunately or fortunately, most developers have lost the ability to build something from the source code for free. Unless extensions for the same PHP (pecl) sometimes have to be collected.
As an option, I suggest using such a wonderful thing as containerization, namely Docker. At the current time, this is the most elegant and correct solution. Added linking with MySQL DBMS to the example below

docker network create mysql_net

docker run --name app --net mysql_net -d -p 8080:80 \
  -v /host/to/path/app:/var/www/app/ \
  -v /host/to/path/config_apache:/etc/apache2/sites-enabled/ \
  romeoz/docker-apache-php:5.4

, where
Next, we will raise the container with the DBMS:
docker run --name db --net mysql_net -d \
  -v /host/to/path/data:/var/lib/mysql \
   romeoz/docker-mysql:5.5

, where /host/to/path/datais the directory with your data (DB).
In Bitrix CMS, as a host in the database settings, you must specify db, because the DBMS container has the following name - --name db.
Your application will be available at http://localhost:8080. For beauty, you can set in /etc/hostsyour domain, for example, 127.0.0.1:8080 myapp.
If you are used to editing the database using the phpmyadmin web client, then here is an instruction on how to raise the official container for it. If I were you, I would use a different client - free or not free. For example, all JetBrains products, including the PHPStorm IDE, have an excellent DataGrip tool, formerly known as 0xDBE.
Naturally, there is a need to understand this a bit, but believe me, it's worth it. This approach is the future. Plus, you don’t have to litter your host system with all sorts of garbage, because the container can always be killed, and the image that generated it can be deleted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question