How to compile php on ubuntu and make it work with apache?

Can work in PHP 5.6 on Ubuntu 12.04.5 LTS ?
I already tried everything found in Google, for example:

apt-get install software-properties-common python-software-properties
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php5.6

After entering the command apt-get install php5.6, is:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5.6
E: couldn't find any package by regex 'php5.6'

since nothing happened I decided to act the trail. instructions:

zjN3wyR8uQ8.jpg
it worked out, but how to put it under apache?
June 10th 19 at 14:23
3 answers
June 10th 19 at 14:25
Solution
Hi,
Still had the key, add "--with-apache[=DIR]" and get a static module for Apache or the default directory or Ozerskoe. Well, in Apache to connect to this module.
Hi. Damn, how do I do it now to clean it up?
To alter just by adding the flag --with-apache=/etc/apache2 ? - Willie commented on June 10th 19 at 14:28
And the flag --with-apxs2=/usr/sbin/apxs2 is not needed? - Willie commented on June 10th 19 at 14:31
--with-apache[=DIR]
Collects static module for Apache. DIR is the top - level Apache build directory, defaults to /usr/local/apache.

--with-apxs2[=FILE]
Collects dynamic module for Apache 2.0. FILE is the optional pathname to the tool "Apache apxs", which is used for apxs by default.

What you need - static or dynamics - you choose. - nicklaus.OKeefe commented on June 10th 19 at 14:34
--with-apache[=DIR]
Collects static module for Apache. DIR is the top - level Apache build directory, defaults to /usr/local/apache.

And if I did not collect apache? Here /usr/local/apache is empty - Willie commented on June 10th 19 at 14:37
Well, it is necessary to collect apache and there will not be empty. Can you try to build php with the key, but without the presence of apache and see what happens. I'm so far in the experiments did not go :-). I usually put the first apache, and then everything else (PHP, MySQL, PostgreSQL, ...). - nicklaus.OKeefe commented on June 10th 19 at 14:40
I don't know what will happen next, how to assemble an apache, php and have... because I already installed apache 2.22.2, php 5.4. How do I do to run the compiled apache and php 2.22.34 5.6.32?

When I set the path to apache, I wrote a mistake
configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache2


Wrote so find / -name httpd.h, the result is:
/usr/include/apache2/httpd.h
/usr/local/apache2/include/httpd.h
/tmp/httpd-2.2.34/include/httpd.h


Wrote --with-apache=/usr/include/apache2, same error, and so the same with --with-apache=/usr/local/apache2/include

What to do? - Willie commented on June 10th 19 at 14:43
It is necessary to warn that you are already old Apache and PHP :).
First, you need to clean the old version, and then rebuild a new one. In the latest OS you can do the upgrade, but this is not the case. - nicklaus.OKeefe commented on June 10th 19 at 14:46
What's in my make? Let's say I collect all this, how to install it? - Willie commented on June 10th 19 at 14:49
The installation from source goes in three stages:
1) ./configure ... configuration,
2) make - Assembly
3) make install - install. - nicklaus.OKeefe commented on June 10th 19 at 14:52
Read the README, INSTALL and similar files that come with the source code. They are all written. - nicklaus.OKeefe commented on June 10th 19 at 14:55
The system is fucked up. Congratulations. - Domingo.Keeling11 commented on June 10th 19 at 14:58
And the folder /etc/apache2 will be created when you start apache2? - Willie commented on June 10th 19 at 15:01
and what to do with configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache2 ? - Willie commented on June 10th 19 at 15:04
If everything is clean and new will be done from scratch according to the instructions, no errors will be made. All the necessary directories, scripts, etc. will be created during the installation phase. - nicklaus.OKeefe commented on June 10th 19 at 15:07
I read that --with-apache only apache 1.x and --with-apxs2 for apache 2.x.
And do not tell me where to look, what to delete?
make uninstall produces
make: *** No rule to make target `uninstall'. Stop. - Willie commented on June 10th 19 at 15:10
About version 1 and version 2 can't say for sure, look at the docks. I sortof of "standard software" already forgotten, when collected, 10 years ago, on the 5th or 6th Fre.

Pulling also difficult, as judging by the conversation and your actions your system already, as noted by "Pajares". In such cases, I just clean everything by hand (viewing processes, if they are, stop them, watching scripts run processes to identify ways, search paths, delete, etc.).

I told you that your case is purely handmade. You there, the vital files, websites, services? If Yes, then do unload database, backups, etc. and update OS and SOFTWARE, then everything will roll forward from the backup. If not, then just update the OS and put fresh IN. - nicklaus.OKeefe commented on June 10th 19 at 15:13
June 10th 19 at 14:27
apt-get install software-properties-common python-software-properties

It has nothing to do with PHP.

apt-get install php5.6
E: Unable to locate package php5.6

Because there is no such package.
It is necessary to explicitly specify the desired. For example:
sudo apt-get install php5.6-cli php5.6-common php5.6-fpm php5.6-gd php5.6-curl php5.6-json php-xdebug php5.6-intl php5.6-mysql php5.6-xml php5.6-mbstring


P. S. better yet, just install php7
There is no php5.6 not higher. Only php 5.4 - Willie commented on June 10th 19 at 14:30
come on! In ppa:ondrej/php is even 7.2 - Willie commented on June 10th 19 at 14:33
After add-apt-repository ppa:ondrej/php, wrote apt-get update and the team that threw. I wrote that already tried everything (

E: Unable to locate package php5.6-cli
E: couldn't find any package by regex 'php5.6-cli'
E: Unable to locate package php5.6-common
E: couldn't find any package by regex 'php5.6-common'
E: Unable to locate package php5.6-fpm
E: couldn't find any package by regex 'php5.6-fpm'
E: Unable to locate package php5.6-gd
E: couldn't find any package by regex 'php5.6-gd'
E: Unable to locate package php5.6-curl
E: couldn't find any package by regex 'php5.6-curl'
E: Unable to locate package php5.6-json
E: couldn't find any package by regex 'php5.6-json'
E: Unable to locate package php-xdebug
E: Unable to locate package php5.6-intl
E: couldn't find any package by regex 'php5.6-intl'
E: Unable to locate package php5.6-mysql
E: couldn't find any package by regex 'php5.6-mysql'
E: Unable to locate package php5.6-xml
E: couldn't find any package by regex 'php5.6-xml'
E: Unable to locate package php5.6-mbstring
E: couldn't find any package by regex 'php5.6-mbstring' - nicklaus.OKeefe commented on June 10th 19 at 14:36
I have these lines working. Upon confirmation, I hope they pressed "y"?
Then I suggest you to upgrade Ubuntu to the latest version. - Willie commented on June 10th 19 at 14:39
generally no, no confirmation yet... too lazy to update... - nicklaus.OKeefe commented on June 10th 19 at 14:42
frankly,: -), you will spend many times more time, effort and nerves trying to "dance, shamanic dance" with the installation of a more or less new versions of software on the system 5 years ago than if you would have updated your OS and then "out of the box" freewheeling any recent software.

Although I agree, experience is the best behavior, so he sinned from time to time :-) - Willie commented on June 10th 19 at 14:45
at present no confirmation

Yeah, no confirmation
E: Unable to locate package php5.6-cli
E: couldn't find any package by regex 'php5.6-cli'
- nicklaus.OKeefe commented on June 10th 19 at 14:48
June 10th 19 at 14:29
P. S. better yet, just install php7

and even better, nginx+php7.1-fpm
No such opportunities, because of the version of ubuntu, only available in php 5.4, other versions did not accept. And yet I have a proxy. System update while laziness... - Willie commented on June 10th 19 at 14:32
Then it is just php7.2-fpm - Willie commented on June 10th 19 at 14:35
I think once Node.js, Koa, GraphQL - nicklaus.OKeefe commented on June 10th 19 at 14:38

Find more questions by tags ApachePHPUbuntu