FreeBSD: Fatal error: Call to undefined function session_name()

I just setup Apache and PHP on FreeBSD 9, configured a vhost, then when I tried to access it, I got the following error:

Fatal error: Call to undefined function session_name() in /srv/www/sugaku.domain.com/inc/init.php on line 144

so apparently, the “session” support is missiong from php5 installation. To fix it, I need to install php5-session port.

Let’s do it.

# whereis php5-session
php5-session: /usr/ports/www/php5-session
portmaster www/php5-session

If the installation is successful, then we can restart apache.

# service apache22 restart

or

# /usr/local/etc/rc.d/apache22 restart

That’s it.

Credit: http://forums.freebsd.org/showthread.php?t=12565

Installing FreeBSD 9 source

Well, I need FreebSD 9 source to compile fusefs-kmod, which is required by gvfs, which’s in turn required by xfce.

A lot of people recommend to use sysinstall to add the so called userland sources.

sysinstall -> Configure -> Distribution -> src

However, it didn’t work!!

Thanks to wblock@[1] who pointed out that “sysinstall is mostly dead” and suggested a few ways to get the sources to your system. One of them is:

Download the tar file that matches the version you installed. In my case it’s amd64:
# wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/9.0-RELEASE/src.txz

Unpack the archive to /usr/src:
# tar -C / -xvzf src.txz

[1] http://forums.freebsd.org/showthread.php?t=29172