Tag Archives: php

Installing module sybase_ct in CentOS 6.x with php 5.4

Firstly,  you may need to import/installl remi repos and development tools into your CentOS.

Then, install php,apache and freetds using yum :

#yum install httpd php freetds freetds-devel
#php -i (to identify php version installed)

Go to php.net and download the php souce code same version as above.
Extract it, and be prepare to compile the souce code.

#./configure –with-sybase-ct=shared,/usr
# cp modules/sybase_ct.so /usr/lib64/php/modules
#cd /etc/php.d/
#vim sybase.ini

and enter the following text;

; Enable SAIBESSSS extension module

restart your apache, and create file contain <?php phpinfo(); ?> to check whether the module successfully installed or not. You also can check from terminal by running # php -i | grep sybase
Teston On CentOS 6.6 , PHP 5.4.38, Apache 2.2

php source code : compile on centos

office version of config :
'./configure' '--build=x86_64-unknown-linux-gnu' '--host=x86_64-unknown-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--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' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' '--with-apxs2=/usr/sbin/apxs' '--libdir=/usr/lib64/php' '--enable-pdo=shared' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/lib64/mysql/mysql_config' '--with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config' '--with-pdo-sqlite=shared,/usr' '--with-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite' '--with-sqlite3=shared,/usr' '--disable-phar' '--disable-fileinfo' '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' '--with-sybase-ct=/opt/freetds'

version from http://sheriframadan.com/phpcorner/php54/ :

#! /bin/sh
'./configure' \
'--with-apxs2=/usr/bin/apxs2' \
'--with-curlwrappers' \
'--with-gd' \
'--with-jpeg-dir=/usr' \
'--with-png-dir=/usr' \
'--with-vpx-dir=/usr' \
'--with-freetype-dir=/usr' \
'--with-t1lib=/usr' \
'--enable-gd-native-ttf' \
'--enable-exif' \
'--with-config-file-path=/etc/apache2/' \
'--with-config-file-scan-dir=/etc/apache2/conf.d' \
'--with-zlib' \
'--with-zlib-dir=/usr' \
'--with-gettext' \
'--with-kerberos' \
'--with-imap-ssl' \
'--with-mcrypt=/usr/local' \
'--with-iconv' \
'--enable-sockets' \
'--with-openssl' \
'--with-pspell' \
'--with-pdo-mysql' \
'--with-pdo-sqlite' \
'--enable-soap' \
'--enable-xmlreader' \
'--with-xsl' \
'--enable-ftp' \
'--enable-cgi' \
'--with-curl=/usr' \
'--with-tidy' \
'--with-xmlrpc' \
'--with-xpm-dir' \
'--enable-mbstring' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-shmop' \
'--with-readline' \
'--with-mysqli=/usr/bin/mysql_config' \
'--prefix=/usr/local' \
'--enable-shared' \
'--enable-bcmath' \
'--enable-json' \
'--with-gmp' \
'--enable-intl' \
'--enable-shared' \

module compile ( from http://jehiah.cz/a/compiling-shared-php-modules ):

/usr/local/src/php-4.3.8 # ./configure --with-pgsql=shared,/usr/local/pgsql
/usr/local/src/php-4.3.8 # make
/usr/local/src/php-4.3.8 # cp modules/pgsql.so /usr/lib64/php/extensions/
Note we only have to use the configuration line for the shared module we are compiling. We specify that we want it as a shared module, and the path (if needed). This of course assumes you already have postgres installed.

Then load that extension from php.ini by adding the following line.

[extension section]

currently no explanation.. just for my reference

php output buffering

sample code only, please try it yourself to see the result.

print "In first buffer!\n";
print "In second buffer!\n";
print "In third buffer!\n";



$info = ob_get_contents();
echo $info; /* papar semua content sekaligus */


ref: http://www.linuxformat.co.uk/wiki/index.php/PHP_-_Output_buffering