Reputation: 427
I'm currently using Raspbian Wheezy 7.0 right now. Since PHP 5.6
is not available on the apt repositories for wheezy, I decided to build it from source. The build worked perfectly, I didn't receive any errors from it.
So when I used php -v
it gave me the following output.
PHP 5.6.10 (cli) (built: Sep 18 2016 09:23:21)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Ok, I thought. Perfect, everything is updated like it should be.
Here's where the problem comes in. For some reason, when I use phpinfo()
on my apache2 server. It says that I'm still on version 5.4.45
.
My first guess was that the module apache was using libphp5.so
located in /usr/lib/apache2/modules/
was out of date. But, I have no idea where the libphp5.so
module is for the new php version that I just installed is.
It'd be great if anyone could help me with this or point me in the right direction. I'm using Apache version 2.2
.
Upvotes: 0
Views: 662
Reputation: 11943
As you can see from your console, php -v
is the CLI binary. When building PHP you can build many different binaries for different SAPIs (Server APIs), one of them being CLI. Apache2 Handler or mod_php would be another one. In order to build your PHP as an Apache httpd module you need to make sure you include the --with-apxs2
configuration option when compiling from source. This means running ./configure --with-apxs2
before you make; make install;
the binary. You then need to make sure to load the newly built libphp5.so
or mod_php.so
(however you built it) to the appropriate directly and load it from your Apaache httpd config. Where your newly compiled binaries are stored, depends on your compile time configuration options and environment, but typically they are located in $PREFIX/$HOME/bin
. So for example, if you compiled --with-prefix=/usr
you might get /usr/php/bin/libphp5.so
, but typically the binary is moved for you by make install
. You do need to make sure you restart httpd for the newly built binary to be loaded.
See the PHP manual on installation for more details.
Upvotes: 1