วันนี้มีเทส compile php5.6.x บน freebsd 12.x ดูครับแล้วพบว่ามี error เกี่ยวกับ onig_get_encoding
คือจริงๆ ใน directadmin ก็มีออก patch มาเพื่อแก้ไขตัว php_mb_regex_t
cd /usr/local/da/custombuild/php5.6/ext/mbstring
==== Start of Patch ====
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -454,7 +454,7 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patlen, OnigOptionType options, OnigEncoding enc, OnigSyntaxType *syntax TSRMLS_DC)
OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
found = zend_hash_find(&MBREX(ht_rc), (char *)pattern, patlen+1, (void **) &rc);
- if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) {
+ if (found == FAILURE || onig_get_options(*rc) != options || onig_get_encoding(*rc) != enc || onig_get_syntax(*rc) != syntax) {
if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
onig_error_code_to_str(err_str, err_code, err_info);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);
==== End of Patch ====
OpenSSL version
It is known fact that PHP 5.x versions have issues to compile against OpenSSL 1.1.1. So first we need to install an alternative OpenSSL version. In FreeBSD ports we can find openssl-unsafe, which offers OpenSSL 1.0.2. So we install it
=== install portsnap on freebsd12.x
#portsnap fetch
#portsnap extract
cd /usr/ports/security/openssl-unsafe
make && make install
# /usr/local/openssl-unsafe/bin/openssl version
OpenSSL 1.0.2-chacha (1.0.2k-dev)
cd /usr/local/directadmin/custombuild
mkdir -p custom/php/
cp -p configure/php/configure.php5* custom/php/
mkdir -p custom/fpm/.custom_openssl
touch custom/fpm/.custom_openssl
perl -pi -e 's|with-openssl|with-openssl=/usr/local/openssl-unsafe|g' custom/php/configure.php5*
cd /usr/local/directadmin/custombuild
./build update
./build php
===> เปิดอีก session ทำการ copy patch ext/mbstring/php_mbregex.c เข้าไปทับตัวที่ download source php-5.6.40 ไปด้วยนะครับ =>
cd /usr/local/directadmin/custombuild
cp php_mbregex.c php-5.6.40/ext/mbstring/.
./build rewrite_confs
https://forum.directadmin.com/threads/migrating-from-openssl-to-openssl-unsafe.60104/