Zachary Vincze Zachary Vincze - 1 year ago 167
PHP Question

Apache2 using PHP 5.4 while 5.6 is installed

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
on my apache2 server. It says that I'm still on version

My first guess was that the module apache was using
located in
was out of date. But, I have no idea where the
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

Answer Source

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 or (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/, 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download