wiki:FreeBSD Php Compile Issues

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 :

Note that imap port needs to be compiled and installed in advance even though we are overriding it!

see : /usr/ports/mail/php74-imap

and then currentconfig (it my common script)

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 compiled in and added to php.ini file manually

These must be COPIED into /usr/local/include/php/ext

  • 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
  • You may need to copy iconv.so /usr/local/lib/php/20190902-zts/
  • Use at command prompt php -r "iconv ( 'UTF-8', 'ASCIITRANSLIT', 'PHP_BUG' );" to verify
  • 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
  • From :
    Recently I had to install ImageMagick on FreeBSD. The following commands achieved this without a problem.
    
    cd /usr/ports/graphics/ImageMagick-nox11/
    make install clean
    service apache22 stop
    cd /usr/ports/graphics/pecl-imagick/
    make install clean
    service apache22 start
    
    NOTE: For some of the package dependencies you will be prompted to select optional add-ons. 
    I left all the config options untouched except for those which provided integration with the X11 system. 
    Those once I disabled.
    

Last modified 15 months ago Last modified on 02/06/23 03:26:29
Note: See TracWiki for help on using the wiki.