Search

Developer on rampage

geeky stuff for geeky lovers, hacking, js, ios, android, linux, osx..

php 7 and Mageia 5.1 (Second Round?)

 

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 :
Include conf/modules.d/*.conf
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:
 <IfModule !mod_php.c>
Lets replace with :
 <IfModule !mod_php7.c>
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 ):
$ ./buildconf
$ ./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
$ 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
PHPINIDir /etc/php7.ini
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.

Installing php7 on Mageia 5

Some Linux distributions take their time to package new stuff! Although Mandriva was a Linux distro that was famous for bringing the cutting edge every new version , it’s successor is lagging behind ages in comparison. We’re almost at the end of 2016 and there’s still now sight of php7 packages.
Since I have a server that has been Mandriva for decades (and now is running Mageia 5) and being half world apart, swapping  Linux distro isn’t an option so I decided to give it a go and install php 7 from source.

Since php7 actually brings a huge increase on speed and resource optimization I do recommend it.  I’m focused on Mageia 5 but general instructions can be easily applied to other linux distros.

We’ll need the following packages installed:

well use the php from package to figure what was the configuration used by running from cli :

php -i | grep Configure

this should return something like :

Configure Command =>  ‘./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’ ‘–with-recode=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’ ‘–enable-phpdbg’

After striping the single quotes we have the configuration to apply to our source code.
For mageia 5 I had to remove “–with-recode=shared,/usr”, “–enable-phpdbg” and add “–disable-phpdbg”. (My Idea is to keep it close to the distro package settings but if you know exactly what you’re going to need and want to drop some  unneeded modules just remove them from the list )
Let’s unpack php7 code , cd into code directory and execute the config command.
Be prepared to find errors that my be different from distro to distro. I’m compiling php7 on Mageia 5 so after a few tries this is the list of packages I had to install before I could execute the configure script successfully.

  • enchant-devel
  • jpeglib-devel
  • xpm-devel
  • libgd-devel
  • lib64jbig-devel
  • lib64c-client-devel
  • firebird-devel
  • onig-devel
  • libmbfl-devel
  • lib64mcrypt-devel
  • lib64freetds-devel
  • lib64readline-devel
  • lib64recode-devel
  •  net-snmp
  • net-snmp-devel
  •  lib64xmlrpc-epi-devel
  • lib64zip-devel

So if you want to compile your php7 in mageia 5 you’ll need to execute:
urpmi enchant-devel jpeglib-devel xpm-devel libgd-devel lib64jbig-devel lib64c-client-devel firebird-devel onig-devel libmbfl-devel lib64mcrypt-devel lib64freetds-devel lib64readline-devel lib64recode-devel net-snmp net-snmp-devel lib64xmlrpc-epi-devel lib64zip-devel

after we configured the code project, we need to execute make:
If you get the following error “/usr/bin/ld: cannot find -lxmlrpc” it’s because the lib file has a different name so you can just create a soft link , inside of /usr/lib or /usr/lib64
ln -s libxmlrpc-epi.so libxmlrpc.so

With Mageia 5 (64bit version) there was an issue compiling related with readline it turned out that 64 bit version needed a soft link in /lib64 so I created the link and after it running make proceeded without errors:
ln -s /lib64/libmbfl.so.1.0.1 /lib64/libmbfl.so

To finally install you just need to run make install inside the php source directory but that won’t work in mageia because the script needs to find at least one line starting LoadModule inside the httpd.conf so before running the make install we need to edit the file:
/ect/httpd/conf/httpd.conf
Find : Include conf/modules.d/*.conf
and in the next line just add LoadModule php_module modules/mod_php.so

remove installed php packages and execute make install
once is done you can check if php is the right version by running:
php -v

PHP 7.0.12 (cli) (built: Oct 21 2016 12:40:18) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

 

No we are just missing to load all the php modules we compiled . My approach was to add a single include all file into /etc/php.d  that way I can enable or disable modules by commenting lines and it looks like this: (/etc/php.d/00_all.ini)

; Compiled Modules
extension=bcmath.so
extension=bz2.so
extension=calendar.so
extension=ctype.so
extension=curl.so
extension=dba.so
extension=dom.so
extension=enchant.so
extension=exif.so
extension=fileinfo.so
extension=ftp.so
extension=gd.so
extension=gettext.so
extension=gmp.so
extension=hash.so
extension=iconv.so
extension=imap.so
extension=interbase.so
extension=intl.so
extension=json.so
extension=ldap.so
extension=mbstring.so
extension=mcrypt.so
extension=mysqli.so
extension=mysqlnd.so
extension=odbc.so
extension=opcache.so
extension=openssl.so
extension=pcntl.so
extension=pdo_dblib.so
extension=pdo_firebird.so
extension=pdo_mysql.so
extension=pdo_odbc.so
extension=pdo_pgsql.so
extension=pdo.so
extension=pdo_sqlite.so
extension=pgsql.so
extension=phar.so
extension=posix.so
extension=readline.so
extension=session.so
extension=shmop.so
extension=snmp.so
extension=soap.so
extension=sockets.so
extension=sqlite3.so
extension=sysvmsg.so
extension=sysvsem.so
extension=sysvshm.so
extension=tidy.so
extension=tokenizer.so
extension=wddx.so
extension=xmlreader.so
extension=xmlrpc.so
extension=xml.so
extension=xmlwriter.so
extension=xsl.so
extension=zip.so
extension=zlib.so

 

Finally restart your Apache and Bob is your uncle!

 

Into the Surface

It has been 6 month since I got my surface pro 4 and as an IT professional it’s hard to admit when we make poor choices, unfortunately this is one of those occasions.

I admit the ad was pretty cool and the idea of having a tablet with a conventional processor where you could run a desktop operating system (without that security Jibber Jabber from IOS and android which is just snake oil to keep their users tide to contracts) is really appealing to any IT professional.

Dreaming is one thing, living it not so much.

First 3 month it was a nagging pain, whenever the system went to sleep , I would get the Black Screen of Death (I guess Black is the new Blue in windows 10 ) whenever I tried to power up the tablet again. The only solution was to hard power off and that means to loose anything you didn’t save before. Right there any other table seemed to be pretty much better!

SCORE: IOS 1 | Android 1 | SP4 -1;

Well maybe the pen will mark the difference! Yes I am from the old school when personal digital assistants (PDAs) got to the market , most of them monochrome but we could write our life out with it, it would only take a couple of hours to get the hang of it and in the end I was handwriting my notes, emails and even code.  Today most developers hardly know how to use a pencil, they go to school with ultra thin laptops and their tablets,they have no idea what they are missing, or maybe I’m the only one missing it .

Using the pen with SP4 has been a source of mixed feelings, when using it as a pencil (With One Note, I have to say, I like the way you can lay your hand onto the screen while writing and  it works like real paper) it  really works like one. It detects the different pressure and you can see that in the stroke weight, sometimes I even forget I’m using a tablet, the pen is comfortable and weighs like a real good pen. On the other hand, handwriting recognition smells,  I’m left handed and obviously some letters I stroke differently from other people. So it’s a pain to use handwritten  recognition because the stupid thing most of the times misunderstands what I’m writing and to make things worse, it tries to match it to the system’s language dictionary. Although I can learn to write differently every time the system fails to understand what I’m writing I don’t just loose one character I lose a  whole sentence!!!
For that same reason it’s unthinkable to use it to write code since most times we write gibberish (If you are a developer you know what I’m talking about , all those descriptive variable names and function names) .
Now you might ask why would you want to do that? For starters have you seen how much screen space a soft keyboard takes ? So if you try to type code like that you’ll end up wasting a lot o time scrolling up and down to read your code context.

Also if you are on the move it becomes hard to find a suitable place where you can unfold your laptop to use the keyboard (without ever dropping it and possibly crack your screen).
So a tablet with a pen where you could write like a paper note book would it be the ultimate hacker’s tool.

Unfortunately the story isn’t over , 2 month ago the ultimate Microsoft fix for the black screen of death made things worse, now the system wouldn’t just freeze with a black screen , instead the battery would be drained in less than half an hour.

The screen flickers like an old neon light whenever I use a screen setting lower than brighter and every  other month I have corrupted system files , although there’s no new software installed except  those despicable  system updates.

Like a roller coaster every time the surface gets an update I never know what to expect. Will it be thrilling or will it be scary?

The last update still hasn’t fixed the screen flickering issue, did partially solved the battery draining and added a new system freezing issue whenever I open a couple of web pages ( doesn’t matter which browser I use , always get the same result a frozen system) but since I’m not princess Elsa , I can’t let it go!

Obviously this tablet can’t even replace a paper notepad how can someone expect to replace a real computer with this thing?

 

 

First blog post

This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Blog at WordPress.com.

Up ↑