Category Archives: PHP

Anything related to the PHP language

Upgrading PHP from 7.0.22 to 7.1.9

I created a shell script which began its simple life as


# Use on first run

# Use on subsequent runs

portupgrade ${FLAGS} lang/php71 lang/php70 || exit

portupgrade ${FLAGS} textproc/php71-ctype      textproc/php70-ctype      || exit
portupgrade ${FLAGS} ftp/php71-curl            ftp/php70-curl            || exit
portupgrade ${FLAGS} textproc/php71-dom        textproc/php70-dom        || exit
portupgrade ${FLAGS} graphics/php71-gd         graphics/php70-gd         || exit
portupgrade ${FLAGS} devel/php71-gettext       devel/php70-gettext       || exit
portupgrade ${FLAGS} security/php71-hash       security/php70-hash       || exit
portupgrade ${FLAGS} converters/php71-iconv    converters/php70-iconv    || exit
portupgrade ${FLAGS} devel/php71-json          devel/php70-json          || exit
portupgrade ${FLAGS} net/php71-ldap            net/php70-ldap            || exit
portupgrade ${FLAGS} converters/php71-mbstring converters/php70-mbstring || exit
portupgrade ${FLAGS} security/php71-mcrypt     security/php70-mcrypt     || exit
portupgrade ${FLAGS} databases/php71-memcache  databases/php70-memcache  || exit
portupgrade ${FLAGS} www/php71-opcache         www/php70-opcache         || exit
portupgrade ${FLAGS} security/php71-openssl    security/php70-openssl    || exit
portupgrade ${FLAGS} databases/php71-pdo       databases/php70-pdo       || exit
portupgrade ${FLAGS} databases/php71-pdo_pgsql databases/php70-pdo_pgsql || exit
portupgrade ${FLAGS} databases/php71-pgsql     databases/php70-pgsql     || exit
portupgrade ${FLAGS} www/php71-session         www/php70-session         || exit
portupgrade ${FLAGS} textproc/php71-simplexml  textproc/php70-simplexml  || exit
portupgrade ${FLAGS} net/php71-soap            net/php70-soap            || exit
portupgrade ${FLAGS} net/php71-sockets         net/php70-sockets         || exit
portupgrade ${FLAGS} databases/php71-sqlite3   databases/php70-sqlite3   || exit
portupgrade ${FLAGS} textproc/php71-wddx       textproc/php70-wddx       || exit
portupgrade ${FLAGS} textproc/php71-xml        textproc/php70-xml        || exit
portupgrade ${FLAGS} archivers/php71-zlib      archivers/php70-zlib      || exit

portupgrade ${FLAGS} www/mod_php71 www/mod_php70 || exit

After running the script for a second time and a third time, etc, the script was successively changed to:


# Use on first run

# Use on subsequent runs

#portupgrade ${FLAGS} lang/php71 lang/php70 || exit

#portupgrade ${FLAGS} textproc/php71-ctype      textproc/php70-ctype      || exit
#portupgrade ${FLAGS} ftp/php71-curl            ftp/php70-curl            || exit
#portupgrade ${FLAGS} textproc/php71-dom        textproc/php70-dom        || exit
#portupgrade ${FLAGS} graphics/php71-gd         graphics/php70-gd         || exit
#portupgrade ${FLAGS} devel/php71-gettext       devel/php70-gettext       || exit
#portupgrade ${FLAGS} security/php71-hash       security/php70-hash       || exit
#portupgrade ${FLAGS} converters/php71-iconv    converters/php70-iconv    || exit
#portupgrade ${FLAGS} devel/php71-json          devel/php70-json          || exit
#portupgrade ${FLAGS} net/php71-ldap            net/php70-ldap            || exit
#portupgrade ${FLAGS} converters/php71-mbstring converters/php70-mbstring || exit
#portupgrade ${FLAGS} security/php71-mcrypt     security/php70-mcrypt     || exit

#portupgrade ${FLAGS} www/php71-session         www/php70-session         || exit
#portupgrade ${FLAGS} archivers/php71-zlib      archivers/php70-zlib      || exit
#portupgrade ${FLAGS} databases/php71-memcache  databases/php70-memcache  || exit

#portupgrade ${FLAGS} www/php71-opcache         www/php70-opcache         || exit
#portupgrade ${FLAGS} security/php71-openssl    security/php70-openssl    || exit
#portupgrade ${FLAGS} databases/php71-pdo       databases/php70-pdo       || exit
#portupgrade ${FLAGS} databases/php71-pdo_pgsql databases/php70-pdo_pgsql || exit
#portupgrade ${FLAGS} databases/php71-pgsql     databases/php70-pgsql     || exit
#portupgrade ${FLAGS} textproc/php71-simplexml  textproc/php70-simplexml  || exit
#portupgrade ${FLAGS} net/php71-soap            net/php70-soap            || exit
#portupgrade ${FLAGS} net/php71-sockets         net/php70-sockets         || exit
#portupgrade ${FLAGS} databases/php71-sqlite3   databases/php70-sqlite3   || exit

portupgrade ${FLAGS} textproc/php71-xml        textproc/php70-xml        || exit
portupgrade ${FLAGS} textproc/php71-wddx       textproc/php70-wddx       || exit

portupgrade ${FLAGS} www/mod_php71 www/mod_php70 || exit

Restart Apache using service apache24 restart.

In the end, PHP 7.0.22 got upgraded to PHP 7.1.9. All is well.

Upgrading lang/php5 to lang/php56

The 20150220 entry in /usr/ports/UPDATING contains no instructions for upgrading lang/php5 to lang/php56, at least not for us compiling our own ports.

I learned the hard way using portupgrade what needs to be done. I have summarised my steps into the script below. Use the script as a guide, and if you do run my script, then you’re on your own. To save you some effort, here’s the script ready for downloading. Continue reading Upgrading lang/php5 to lang/php56

Minor difficulties with PHP 5.3.5, php-mysql 5.3.5, and MySQL 5.5.8 on FreeBSD 8, now solved

Something was wrong with the combination of PHP 5.3.5, php-mysql 5.3.5, and MySQL 5.5.8 on FreeBSD 8 earlier this month. Any attempt to run the command php -v resulted in PHP hanging after outputting the “Zend line”. Either kill(1) the process or type C-c to put it out of its misery, but neither action is any helpful. Continue reading Minor difficulties with PHP 5.3.5, php-mysql 5.3.5, and MySQL 5.5.8 on FreeBSD 8, now solved