Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => Os kernel การปรับแต่ง เพิ่มเติม ลงโปรแกรม บน OS และ ControlPanel Directadmin,Cloud server => Topic started by: golfreeze on มิถุนายน 09, 2020, 02:37:01 pm
-
วันนี้มีเทส 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/
-
cd /usr/local/directadmin/custombuild
mkdir -p custom/php
cp -p configure/php/configure.php53 custom/php/configure.php53
mkdir -p custom/fpm/.custom_openssl
touch custom/fpm/.custom_openssl
perl -pi -e 's|with-openssl|with-openssl=/usr/local/lib_http2|g' custom/php/configure.php53
wget ftp://ftp.openssl.org/source/openssl-1.0.2s.tar.gz
tar xzf openssl-1.0.2s.tar.gz
cd openssl-1.0.2s
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install
./build php_expert 5.3 php-fpm
===> เปิดอีก 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
-
ถ้ายังมี error ssl อยู่อาจจะต้องเอา configure -ssl ออกลองดูนะครับ
cd /usr/local/directadmin/custombuild/custom/php
vi configure.php56
delete
--with-openssl=/usr/local/openssl-unsafe \
แล้วทำการรัน compile เฉพาะ php5.6
./build php_expert 5.6 php-fpm
===> เปิดอีก 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
===reference
https://forum.directadmin.com/threads/migrating-from-openssl-to-openssl-unsafe.60104/page-2