Sunday, February 11, 2018

Compile PHP PostgreSQL undefined symbol lo_lseek64() error

Upgrade PHP with PostgreSQL connect support

My php installed on OS X doesn't have PostgreSQL connect support, I need an upgrade.
$ brew install php56 --with-postgresql [--with-httpd]
doesn't work for my, so I try to compile manually from source.
Download the source from For PREFIX, you can set it to your preferred location, the /usr/local/Cellar location is used by Homebrew.

$ ./configure --prefix=/usr/local/Cellar/php/7.2.2 --with-pgsql=/usr/local/Cellar/postgres/10.2

This compile successfully, but I am not replacing the old php on the system, the apache always load the old php version. I need ( or for apache to locate the new php.

$ ./configure --prefix=/usr/local/Cellar/php/7.2.2 --with-pgsql=/usr/local/Cellar/postgres/10.2 --with-apxs2=`which apxs`
(apxs command is from Apache)
This fail.
There are 3 groups of undefined symbols

1. undefined symbol _lo_lseek64()
- error from PostgreSQL, some issue with the configuration, I link it to libpq.a to solve.
2. undefined symbol _SSL_XXX
- link openssl-1.1, which is an older version on my system
3. Disable GSSAPI on Postgresql
- $ brew edit postgresql, delete --with-gssapi
- $ brew reinstall postgresql

You might not experience all the 3 issues.
How to link the missing library?
$ edit php-7.2.2/Makefile
For a quick hack, I just add in MH_BUNDLE_FLAGS =
either -L/usr/local/Cellar/postgresql/10.2 -lpq or /usr/local/Cellar/postgresql/10.2/lib/libpq.a
-L/usr/local/Cellar/openssl@1.1/lib -lcrypto -lssl
/usr/local/Cellar/openssl@1.1/lib/libcryptio.a /usr/local/Cellar/openssl@1.1/lib/libssl.a

My system is Mac OS X 10.9 Mavericks, Homebrew. I have tried compiling php-5.6 and php-7.2, both seems ok for me. I try php7.
$ ./configure --prefix=/usr/local/Cellar/php72/7.2.2_13 --with-mysqli=/usr/local/Cellar/mysql/5.6.25/bin/mysql_config --with-pdo-mysql=/usr/local/Cellar/mysql/5.6.25 --with-pgsql=/usr/local/Cellar/postgresql/10.2 --with-pdo-pgsql=/usr/local/Cellar/postgresql/10.2 --with-apxs2=`which apxs`
$ cp libs/ /usr/local/libexec

$ edit /etc/apache2/httpd.conf
# LoadModule php5_module libexec/apache2/
LoadModule php5_module /usr/local/libexec/
LoadModule php7_module /usr/local/libexec/

$ sudo apachectl stop
$ sudo apachectl -M
rewrite_module (shared)
php5_module (shared)
php7_module (shared)
hfs_apple_module (shared)
Syntax OK
$ sudo apachectl start
$ curl http://localhost/php/phpinfo.php

PHP Version 7.2.2

PostgreSQL Support enabled

Friday, June 02, 2017

A Complain to Maxis Auto Upgrade

Is so much different in Maxis center of today and compare with 9 to 10 years ago.

About 10 years ago, I walk in to Maxis center, check for any offer for cheaper package than the 30 per month that I was having. Might not be something cheaper but may be more free calls. The attendance was so nice, help me to scan through my bills, so that he can suggest a mobile package for me.

I recall, even Digi has a similar service at that time, they advertised that mobile subscriber can go to their service center, their expert will find out what is the suitable package for the subscriber.

My mobile package is very old, is so old that the Maxis center people there don't even know there is such a pakcage, until they check through the computer. They told me the call rate is expensive, is not available anymore. They also told me that under rule and regulation, they have to keep the package as long as there are subscribers still subscribe to it. It make sense for me.

The Maxis expert (I am not sure he is the expert, but he do his job quite weell) scan through my bill and told me, even though my existing call rate is more expensive, but with my using habbit, the package that I was subscribing is the cheapest for me.

I keep using the 30 per month package. Later there are some better (sound better) packages like Surfmore 30. Same price, but with more (300(?) minutes) free calls. I was busy and lazy to walk in Maxis center to change my subscription package. I am happy with my existing package as long as it doesn't exceed my budget.

Recently Maxis 'upgrade' those old packages to a new one with added price. You can read from the discussion forum in here. They give extra data, but the price will generally increase from 30 to 38.

I walk in to Maxis center to file a complain. My argument is:
1. Maxis shouldn't change my package without my approval. Maxis argue that it is an upgrade.
2. Maxis can add in data for my subscription package, but Maxis shouldn't increase the price.

The customer service refuse to file a complain for me, until I told him that the Maxis CEO apologize last year which results from some unhappy customers. They promise to call me back and they didn't.

I look back to last year (April) incident again. As Maxis give special offer to those who want to opout from Maxis and switch to other mobile service provider for better package. Those loyal customers with Maxis for many years were not given the offer. When customer call in for the offer, Maxis reply is only selected customers are given for the offer.

The post about the incident came out on the social media, Maxis try to ignored it, and is like snowball getting bigger and bigger. You can read the story from here and here, Malaysians are angry with Maxis. You can find many other related posts.

I summerize a few points from the post, what went wrong:
1. Too much of delay for an official response
2. The solution provided misses the main complain completely
3. Attempts to explain things from the telcos point of view (and not at the customer point of view)

After 12 months time, I experience the same things. Not much improvements.

I look at the live video from Maxis (here), the Maxis CEO Morten (Morten Lundal) appearred to be impatient and not sincere at all.

Thursday, October 06, 2016

Solve Rails Native Compile Issue

I seldom blog about issue on Windows, because I don't really have a Windows machine with me. This will be an exceptional case that I show how to solve a Rails' native compile issue.

If you see an error from Rails on Windows system, something similar like this

c:> gem install son
ERROR: Error installing json:
ERROR: Failed to build gem native extension

The reason is, gem try to build native library to improve performance, but it was not able to do it on your Windows system.

The easiest is to install DevKit from The DevKit will be installed at c:\DevKit. Just take note which DevKit to be installed, 32 bits or 64 bits.

Set Windows system PATH environment:
Control Panel > System > Advanced system settings
System Properties > Environment Variables > (Select Path and Edit...), add a new Path

start a new command prompt (cmd):
c:> gem install json

You should be able to install json now.