wiki:FreeBSD Php Compile Issues

Version 3 (modified by Paul Kulda, 2 years ago) ( diff )

--

FreeBSD Php Compile Issues

FreeBSD includes a modern version of OpenSSL as part of its base system, but doesn't appear to have a pkg-config file, so the PHP configure script can't find the libraries. When compiling PHP on FreeBSD, you should define the OPENSSL_LIBS and OPENSSL_CFLAGS environment variables before running PHP's configure. For FreeBSD 12, the following will work:

export OPENSSL_LIBS="-L/usr -lssl -lcrypto -lz" && export OPENSSL_CFLAGS="-I/usr/include" && ./configure --with-openssl [...other configure options...]

Compatibility Issues In General with PHP 7.x.xx

Basically PHP will work for the most part outta the box but thus far the following extentions need to be compiled from ports and installed manually.

So that being Said Use this to Compile the Base :

export OPENSSL_LIBS="-L/usr -lssl -lcrypto -lz" && export OPENSSL_CFLAGS="-I/usr/include" &&  ./configure \
--with-layout=GNU \
--enable-mbstring \
--with-ldap \
--without-iconv \
--with-imap \
--with-imap-ssl \
--enable-exif \
--enable-gd \
--with-zip \
--enable-ftp \
--with-jpeg \
--with-curl \
--with-openssl=/usr/local \
--with-zlib \
--enable-pdo \
--with-pdo-pgsql \
--with-pgsql \
--with-mysqli \
--with-config-file-scan-dir=/usr/local/etc/php \
--enable-ctype \
--with-libxml \
--with-password-argon2=/usr/local \
--program-prefix= \
--enable-mysqlnd \
--enable-cli \
--disable-cgi \
--with-apxs2=/usr/local/sbin/apxs \
--enable-maintainer-zts \
--enable-dtrace \
--prefix=/usr/local \
--localstatedir=/var \
--mandir=/usr/local/man \
--infodir=/usr/local/share/info/ \
--build=amd64-portbld-freebsd12.1 \
build_alias=amd64-portbld-freebsd12.1 \
PKG_CONFIG=pkgconf \
CFLAGS='-O2 -pipe -fstack-protector-strong -fno-strict-aliasing'  \
CPP=cpp \
CXXFLAGS='-O2 -pipe -fstack-protector-strong -fno-strict-aliasing' 
  • From there please note the following modules need to be compile in and added to php.ini file manually
    • intl extention
    • Found in /usr/ports/devel/php74-intl
    • Add to /usr/local/etc/php.ini file extension=/usr/local/include/php/ext/intl/modules/intl.so

  • iconv.so - Note this was required to fix the apache core dump issues when in use.
  • Found in /usr/ports/converters/php74-iconv
  • Add to /usr/local/etc/php.ini file extension=/usr/local/include/php/ext/iconv/modules/iconv.so
  • imagick.so extention (please see additional notes)
  • Found In /usr/ports/graphics/pecl-imagick
  • Add to /usr/local/etc/php.ini file extension=/usr/local/include/php/ext/imagick/modules/imagick.so

Note: See TracWiki for help on using the wiki.