前提:因为想恢复PHP5217环境,所以尝试启用2017年存的一个镜像。不知什么缘故,网页加载缓慢。已然消耗24小时,打住。
也许:php5217+nginx是一个不错的替代方案。
找回 root 密码:
更新系统:
更新内核:
编译 apache
参考:https://amon.org/php5217
参考:https://amon.org/undefined-symbol-apr_ldap_ssl_init
wget http://archive.apache.org/dist/apr/apr-1.4.8.tar.bz2 && tar -xjvf apr-1.4.8.tar.bz2 && cd apr-1.4.8 && ./configure --prefix=/usr --disable-static --with-installbuilddir=/usr/share/apr-1/build && make && make install wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.bz2 && tar -xjvf apr-util-1.5.2.tar.bz2 && cd apr-util-1.5.2 && ./configure --prefix=/usr --with-apr=/usr --with-gdbm=/usr --with-openssl=/usr --with-crypto && make && make install
wget http://archive.apache.org/dist/httpd/httpd-2.2.34.tar.gz && tar -zxvf httpd-2.2.34.tar.gz && cd httpd-2.2.34 ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most --with-crypto --enable-rewrite --enable-headers --enable-deflate --enable-socache-shmcb --enable-negotiation --enable-ssl --with-ssl=/usr/lib --with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config make && make install
查看版本:
/usr/local/apache2/bin/httpd -v
/usr/sbin/groupadd apache /usr/sbin/useradd -g apache apache chown -R apache:apache /usr/local/apache2/htdocs chmod +w /usr/local/apache2/htdocs
启动 httpd 报错:
symbol lookup error: /usr/local/apache2/bin/httpd: undefined symbol: apr_ldap_ssl_init
编译 sni :
实证未遂:配置文件未能过关。
编译 gnutls :
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.17.tar.xz && xz -d gnutls-3.4.17.tar.xz && tar -xvf gnutls-3.4.17.tar && cd gnutls-3.4.17 export NETTLE_CFLAGS="-I/usr/include/nettle" NETTLE_LIBS="-L/usr/lib64 -lnettle" HOGWEED_CFLAGS="-I/usr/include/nettle" HOGWEED_LIBS="-L/usr/lib64 -lhogweed" P11_KIT_CFLAGS="-I/usr/include/p11-kit-1/p11-kit" P11_KIT_LIBS="-L/usr/lib -lp11-kit" LIBTASN1_CFLAGS="-I/usr/include" LIBTASN1_LIBS="-L/usr/lib -ltasn1" ./configure --prefix=/usr --disable-guile --with-default-trust-store-pkcs11="pkcs11:" --with-included-unistring cp -R /usr/include/p11-kit-1/p11-kit /root/gnutls-3.4.17/lib/p11-kit make make install
更新系统环境:
echo /usr/lib >> /etc/ld.so.conf ldconfig
版本:
gnutls-cli -v
编译 mod_gnutls :
参考:https://amon.org/mod_gnutls
wget https://mod.gnutls.org/downloads/mod_gnutls-0.7.1.tar.bz2 && tar -xjvf mod_gnutls-0.7.1.tar.bz2 && cd mod_gnutls-0.7.1 export LIBGNUTLS_CFLAGS="-I/usr/include/gnutls" LIBGNUTLS_LIBS="-L/usr/lib -lgnutls" ./configure --with-apxs=/usr/local/apache2/bin/apxs make && make install
配置 gnutls :
mkdir -m 0700 /var/cache/gnutls chown apache:apache /var/cache/gnutls
编译 mysql:
如果是mysql5.7的话是无法编译安装上php5.2。
那么得回到早先版本,比如试试5.6系列。
否则报错: 缺少 mysqli 扩展。请检查 PHP 配置。
参考:https://amon.org/php-mysqli
wget -c http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.49.tar.gz && tar -zxvf mysql-5.6.49.tar.gz && cd mysql-5.6.49 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci nohup make -j4 & make install
报错:[Sat Aug 01 00:40:11 2020] [error] (22)Invalid argument: Could not set permissions on ssl_mutex; check User and Group directives
Configuration Failed
The error indicates that there is a discrepancy between the user the webserver runs under and the location where it tries to write something related to the ssl cache.
The user and group on CentOS 7 for example is apache, you can find that as a directive in /etc/httpd/conf/httpd.conf (User apache).
The same goes for Group (Group apache).
You have to verify that user apache in this case has access to the location. Most variable files go in to the run subdirectory. Also note Dire-Willem’s remark.
报错:configuration error: couldn’t perform authentication. AuthType not set!: /test.php
参考:https://www.jianshu.com/p/7e94b819daf6
只需要将 Require all granted 替换为如下内容即可:
Order allow,deny Allow from all
安装PHPMyAdmin
版本 4.0.10之前:
支持 PHP 5.2.17 及之前版本。
wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip && unzip phpMyAdmin-4.0.10.20-all-languages.zip && mv phpMyAdmin-4.0.10.20-all-languages phpmyadmin
报错:Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile]