Every time a Linux distribution releases a new version, system administrators feel the pain!
With that in mind, before upgrading their machines, they create a virtual machine and test their configuration recipes with the new distribution!
Well that’s what I did after someone asked for help to install php 7 in Mageia 5.1.
I already had a recipe that worked with Mageia 5.0 and it was time to see if it required any tweaks with the new version :
The first part of the recipe still applies to get the current settings from the php 5.6 installation (see original post)
The part of settings to be removed was the same :
remove “–with-recode=shared,/usr”, “–enable-phpdbg” and add “–disable-phpdbg”.
Now, the list of required packages is different, following is the list of packages :
apache-devel lib64enchant-devel lib64jpeg-devel lib64xpm-devel lib64gd-devel lib64jbig-devel lib64c-client-devel firebird-devel lib64onig-devel lib64mbfl-devel lib64mcrypt-devel lib64freetds-devel lib64readline-devel lib64recode-devel net-snmp lib64net-snmp-devel lib64xmlrpc-epi-devel lib64zip-devel lib64sqlite3-devel lib64curl-devel lib64gmp-devel postgresql9.3-devel lib64tidy-devel lib64xslt-devel lib64readline-devel
Also one symbolic link was missing :
ln -s /usr/lib64/libxmlrpc.so.3.29 /usr/lib64/libxmlrpc.so
Before we can run “make install” there are some settings needed in Apache. Let’s edit “/etc/httpd/conf/httpd.conf” and just after the line :
let’s add :
LoadModule php_module modules/mod_php.so
Php installation will look for that to know where to install libphp7.so.
Next we need to edit “/etc/httpd/conf/conf.d/security.conf”, and where we find:
Lets replace with :
This is required to allow execute php files .
Since my last recipe, a new php version was available, php 7.1 after reading about the differences and the list of improvements compared with 7.0 I thought: Why not?
So I tried first to download the official source package (http://php.net/downloads.php#v7.1.3) :
Configured fine! Compiled without errors! Installed! but when it was time to load Apache, it didn’t work because of a bug in php 7.1.3 using wrong Apache api calls, well this things happen and it’s already fixed but in the development branch! So to make it work we need to install git:
$ urpmi git
Next clone repository:
$ git clone https://github.com/php/php-src.git
$ cd php-src
Pull the right branch:
$ git checkout PHP-7.1
Prepare code to compile (automake tools and other tools are needed ):
$ ./configure –with-apxs2=/usr/bin/apxs –build=x86_64-mageia-linux-gnu –prefix=/usr –exec-prefix=/usr –bindir=/usr/bin –sbindir=/usr/sbin –sysconfdir=/etc –datadir=/usr/share –includedir=/usr/include –libdir=/usr/lib64 –libexecdir=/usr/libexec –localstatedir=/var/lib –mandir=/usr/share/man –enable-shared=yes –enable-static=no –with-libdir=lib64 –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –disable-debug –enable-inline-optimization –with-regex=system –with-pcre-regex=/usr –with-zlib=/usr –with-pdo-odbc=unixODBC –with-zlib=shared,/usr –with-openssl=shared,/usr –enable-libxml=/usr –enable-mod_charset –without-pear –enable-bcmath=shared –with-bz2=shared,/usr –enable-calendar=shared –enable-ctype=shared –with-curl=shared,/usr –without-curlwrappers –enable-dba=shared –with-gdbm –with-db4 –with-cdb –enable-dom=shared,/usr –with-enchant=shared,/usr –enable-exif=shared –enable-fileinfo=shared –enable-filter=shared –with-pcre-dir=/usr –enable-intl=shared –with-icu-dir=/usr –enable-json=shared –with-libjson –with-openssl-dir=/usr –enable-ftp=shared –with-gd=shared,/usr –with-jpeg-dir=/usr –with-vpx-dir=/usr –with-png-dir=/usr –with-xpm-dir=/usr/X11R6 –with-freetype-dir=/usr –enable-gd-native-ttf –with-t1lib=/usr –with-gettext=shared,/usr –with-gmp=shared,/usr –enable-hash=shared,/usr –with-iconv=shared –with-imap=shared,/usr –with-imap-ssl=/usr –with-ldap=shared,/usr –with-ldap-sasl=/usr –enable-mbstring=shared,/usr –enable-mbregex –with-libmbfl=/usr –with-onig=/usr –with-mcrypt=shared,/usr –with-mssql=shared,/usr –with-mysql=shared,mysqlnd –with-mysql-sock=/var/lib/mysql/mysql.sock –with-zlib-dir=/usr –with-mysqli=shared,mysqlnd –enable-mysqlnd=shared,/usr/bin/mysql_config –with-unixODBC=shared,/usr –enable-opcache=shared –enable-pcntl=shared –enable-pdo=shared,/usr –with-pdo-dblib=shared,/usr –with-pdo-mysql=shared,mysqlnd –with-pdo-odbc=shared,unixODBC,/usr –with-pdo-pgsql=shared,/usr –with-pdo-sqlite=shared,/usr –with-pgsql=shared,/usr –enable-phar=shared –enable-posix=shared –with-readline=shared,/usr –enable-session=shared,/usr –enable-shmop=shared,/usr –enable-simplexml –with-snmp=shared,/usr –enable-soap=shared,/usr –enable-sockets=shared,/usr –with-sqlite3=shared,/usr –with-sybase-ct=shared,/usr –enable-sysvmsg=shared,/usr –enable-sysvsem=shared,/usr –enable-sysvshm=shared,/usr –with-tidy=shared,/usr –enable-tokenizer=shared,/usr –enable-xml=shared,/usr –enable-xmlreader=shared,/usr –with-xmlrpc=shared,/usr –enable-xmlwriter=shared,/usr –with-xsl=shared,/usr –enable-wddx=shared –with-libxml-dir=/usr –enable-zip=shared –with-libzip=/usr –with-interbase=shared,/usr/lib64/firebird –with-pdo-firebird=shared,/usr/lib64/firebird –disable-phpdbg
$ make install
$ cp php.ini-development /etc/php7.ini
Our installation is almost done!
We are now going to create a setup file for php7 module in apache settings.
Open a new file “/etc/httpd/conf/modules.d/03_mod_php7.conf” and copy the following content and save:
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.phtml
Next edit “/etc/httpd/conf/httpd.conf” and comment the following line since we already created a conf file to do it:
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
and Restart Apache!
Enjoy your hot new php7.1 with Mageia 5.1.