Showing posts with label FreeBSD. Show all posts
Showing posts with label FreeBSD. Show all posts

2011-08-08

PHP on FreeBSD : Segmentation fault: 11 (core dumped)

PHP started dumping core after I upgraded MySQL to 5.5.
Everything worked fine, but a core was dumped every time, probably at the exit.

The solution was to rebuild PHP with the
"LINKTHR Link thread lib (for threaded extensions)"
option.

Later, I found a confirmation in this post

2011-06-24

Installing SphinxSearch with libstemmer from FreeBSD ports

Environment: Sphinx 0.9, FreeBSD

Problem:
Sphinx port has libstemmer options commented out in Makefile. With automatic upgrades, it loses stemming for anything except for default EN and RU.

Procedure of rebuilding the port with libstemmer

# (become root)
cd /usr/ports/textproc/sphinxsearch


Create file Makefile.local with this line:
CONFIGURE_ARGS+= --with-libstemmer


make clean
make
fetch http://snowball.tartarus.org/dist/libstemmer_c.tgz
cd work/sphinx-*/
tar zxvf ../../libstemmer_c.tgz
cd ../..
make
make deinstall
make reinstall
make clean

Do not forget to rebuild index if you did not use libstemmer before

2010-11-22

Enabling internal PHP fileinfo on FreeBSD

In a previous post (Upgrading to PHP 5.3 ...), I mentioned a PECL extension pecl-fileinfo-1.0.4

Apparently, installing that extension was a wrong move. The manual says:
This extension is enabled by default as of PHP 5.3.0. Before this time, fileinfo was a PECL extension but is no longer maintained there. However, versions prior to 5.3+ may use the  discontinued PECL extension. 
 Indeed, the PECL version did not work as expected, so I uninstalled it.


Then I discovered that on FreeBSD the internal version of fileinfo was NOT enabled by default.

Here is the relevant part of Makefile found in /usr/ports/lang/php5:
CONFIGURE_ARGS= \
                --with-layout=GNU \
                --localstatedir=/var \
                --with-config-file-scan-dir=${PREFIX}/etc/php \
                --disable-all \
                --enable-libxml \
                --with-libxml-dir=${LOCALBASE} \
                --with-pcre-regex=${LOCALBASE} \
                --with-zlib-dir=/usr \
                --program-prefix=""

 I created a Makefile.local file with just one line
CONFIGURE_ARGS+=--enable-fileinfo

After rebuilding PHP, this test showed that fileinfo is enabled:
$ php --rf finfo_open
Function [ function finfo_open ] {

  - Parameters [2] {
    Parameter #0 [ $options ]
    Parameter #1 [ $arg ]
  }
}

2010-07-06

Upgrading to PHP 5.3 ports on FreeBSD

Environment:
FreeBSD

php5-5.2.12         PHP Scripting Language
php5-curl-5.2.12    The curl shared extension for php
php5-dom-5.2.12     The dom shared extension for php
php5-gd-5.2.12      The gd shared extension for php
php5-iconv-5.2.12   The iconv shared extension for php
php5-mbstring-5.2.12 The mbstring shared extension for php
php5-mysql-5.2.12   The mysql shared extension for php
php5-openssl-5.2.12 The openssl shared extension for php
php5-pcre-5.2.12    The pcre shared extension for php
php5-pdo-5.2.12     The pdo shared extension for php
php5-pdo_mysql-5.2.12 The pdo_mysql shared extension for php
php5-session-5.2.12 The session shared extension for php
php5-simplexml-5.2.12 The simplexml shared extension for php
php5-spl-5.2.12     The spl shared extension for php
php5-xml-5.2.12     The xml shared extension for php
php5-xsl-5.2.12     The xsl shared extension for php
php5-zip-5.2.12     The zip shared extension for php
php5-zlib-5.2.12    The zlib shared extension for php
pecl-stem-1.5.0     A PECL extension which provides word stemming

Task:
Upgrade all ports to php5-5.3.2

  1. Some of the functions are deprecated in PHP 5.3. I had to replace all occurrences of split() with explode() or preg_split() and mysql_escape_string() with mysql_real_escape_string(). Note that mysql_real_escape_string() requires second parameter - DB connection.
  2. Attempt to upgrade ports with `portupgrade php5*` did not work. Some of the extensions do not exist anymore in PHP 5.3, and `pkgdb` was quite confused. I had to delete all php5 ports and then install them again.
  3. PHP 5.3 installed extensions into a new folder /usr/local/lib/php/20090626. My php.ini had reference to the old one, /usr/local/lib/php/20060613. Had to change that manually.
  4. pecl-stem-1.5.0 was not marked for upgrade (pkg_version). However, I had to rebuild it, because it was incompatible with the new PHP libraries.
  5. `php -i` complained about undefined timezone. I had to add date.timezone="America/New_York" to php.ini.
  6. I checked which extensions are now "included with PHP by default" (in docs on http://php.net and in /usr/ports/lang/php5-extensions.Makefile), and installed some of them, in addition to what I had before. There was also a nice "fileinfo" extension that I thought could be useful. Here is the list of extensions after upgrade:
php5-5.3.2_1        PHP Scripting Language
php5-ctype-5.3.2_1  The ctype shared extension for php
php5-curl-5.3.2_1   The curl shared extension for php
php5-dom-5.3.2_1    The dom shared extension for php
php5-filter-5.3.2_1 The filter shared extension for php
php5-gd-5.3.2_1     The gd shared extension for php
php5-hash-5.3.2_1   The hash shared extension for php
php5-iconv-5.3.2_1  The iconv shared extension for php
php5-json-5.3.2_1   The json shared extension for php
php5-mbstring-5.3.2_1 The mbstring shared extension for php
php5-mysql-5.3.2_1  The mysql shared extension for php
php5-openssl-5.3.2_1 The openssl shared extension for php
php5-pdo-5.3.2_1    The pdo shared extension for php
php5-pdo_mysql-5.3.2_1 The pdo_mysql shared extension for php
php5-session-5.3.2_1 The session shared extension for php
php5-simplexml-5.3.2_1 The simplexml shared extension for php
php5-xml-5.3.2_1    The xml shared extension for php
php5-xmlreader-5.3.2_1 The xmlreader shared extension for php
php5-xmlrpc-5.3.2_1 The xmlrpc shared extension for php
php5-xmlwriter-5.3.2_1 The xmlwriter shared extension for php
php5-xsl-5.3.2_1    The xsl shared extension for php
php5-zip-5.3.2_1    The zip shared extension for php
php5-zlib-5.3.2_1   The zlib shared extension for php
pecl-fileinfo-1.0.4 A PECL extension to retrieve info about files
pecl-stem-1.5.0     A PECL extension which provides word stemming
 

2010-07-05

nmap "error MD2 is disabled" workaround

NOTE: this is NOT a solution. It's a quick workaround.

Environment:
FreeBSD 7.2-RELEASE

openssl-1.0.0_2 (installed)
nmap-5.21_1 (to be installed)

Symptoms:
# cd /usr/ports/security/nmap
# make
Error: .... error MD2 is disabled ....

Workaround:

Add to /etc/make.conf:
WITHOUT_SSL=yes

This worked for me because I did not need SSL support in nmap.