(麒麟V10-arm)编译安装php-7.4及部分依赖

2023-11-23 21:41:16 浏览数 (1)

#编译安装openssl

wget https://www.openssl.org/source/openssl-3.0.1.tar.gz

tar -zxvf openssl-3.0.1.tar.gz

./config shared

make && make install

#配置库文件搜索路径

echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

ldconfig -V

代码语言:javascript复制
#编译安装openssl
wget https://www.openssl.org/source/openssl-3.0.1.tar.gz
tar -zxvf openssl-3.0.1.tar.gz
./config shared
make && make install
#配置库文件搜索路径
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -V
代码语言:javascript复制
#安装libxml2,否则No package 'libxml-2.0' found
apt install libxml2
apt install libxml2-dev
#安装freetype,否则no package 'freetype2' found
apt install libfreetype-dev libfreetype6-dev
代码语言:javascript复制
#解决报错No package 'oniguruma' found 
apt  -y  install autoconf automake libtool libonig-dev libgmp-dev

wget https://github.com/kkos/oniguruma/archive/v6.9.5_rev1.tar.gz
tar zxvf v6.9.5_rev1.tar.gz 
cd oniguruma-6.9.5_rev1/
./autogen.sh 
./configure --prefix=/usr --libdir=/lib64
make && make install
代码语言:javascript复制
#解决报错No package 'libzip' found
wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar xf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure && make && make install
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" 
代码语言:javascript复制
#编译安装php
wget https://mirrors.sohu.com/php/php-7.4.9.tar.gz
tar zxvf php-7.4.9.tar.gz
cd php-7.4.9
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-mhash --with-openssl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib --enable-bcmath  --enable-gd --with-jpeg --with-freetype  --enable-mbstring --enable-ftp --enable-sockets   --with-gettext --enable-session --with-curl   --enable-fpm --with-fpm-user=php --with-fpm-group=php   --enable-pdo -enable-tokenizer --with-zip
make && make install
代码语言:javascript复制
#配置文件改名
cd /usr/local/php7/etc/
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
#php命令设置软链接
ln -s /usr/local/php7/bin/* /usr/local/bin
ln -s /usr/local/php7/sbin/* /usr/local/sbin
#查看php的版本
php -v
#
php-fpm
netstat -antp | grep php-fpm
代码语言:javascript复制
#配置nginx的php网页
vim /usr/local/nginx/conf/nginx.conf

        location / {
            root   html;
            index  index.php index.html index.htm;
        }
        location ~ .php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
代码语言:javascript复制
#nginx网页目录下编写简单的php网页,验证访问nginx的php网页
vim /usr/local/nginx/html/index.php

<?php
 phpinfo();
?>
代码语言:javascript复制
#配置service nginx启动
vim /etc/init.d/nginx

#!/bin/sh
# nginx - this script starts and stops the nginx daemin
#
# chkconfig:   - 85 15
 
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse 
#               proxy and IMAP/POP3 proxy server
 
# processname: nginx
# config:      /usr/local/nginx/conf/nginx.conf
# pidfile:     /usr/local/nginx/logs/nginx.pid
 
# Source function library.
 
. /etc/rc.d/init.d/functions
 
# Source networking configuration.
 
. /etc/sysconfig/network
 
# Check that networking is up.
 
[ "$NETWORKING" = "no" ] && exit 0
 
nginx="/usr/local/nginx/sbin/nginx"
 
prog=$(basename $nginx)
 
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
 
lockfile=/var/lock/subsys/nginx
 
start() {
 
    [ -x $nginx ] || exit 5
 
    [ -f $NGINX_CONF_FILE ] || exit 6
 
    echo -n $"Starting $prog: "
 
    daemon $nginx -c $NGINX_CONF_FILE
 
    retval=$?
 
    echo
 
    [ $retval -eq 0 ] && touch $lockfile
 
    return $retval
 
}
stop() {
 
    echo -n $"Stopping $prog: "
 
    killproc $prog -QUIT
 
    retval=$?
 
    echo
 
    [ $retval -eq 0 ] && rm -f $lockfile
 
    return $retval
 
}
restart() {
 
    configtest || return $?
 
    stop
 
    start
 
}
reload() {
 
    configtest || return $?
 
    echo -n $"Reloading $prog: "
 
    killproc $nginx -HUP
 
    RETVAL=$?
 
    echo
 
}
 
force_reload() {
 
    restart
 
}
configtest() {
 
  $nginx -t -c $NGINX_CONF_FILE
 
}
rh_status() {
 
    status $prog
 
}
rh_status_q() {
 
    rh_status >/dev/null 2>&1
 
}
 
case "$1" in
 
    start)
 
        rh_status_q && exit 0
        $1
        ;;
 
    stop)
        rh_status_q || exit 0
        $1
        ;;
 
    restart|configtest)
        $1
        ;;
 
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
 
        rh_status_q || exit 0
            ;;
 
    *)
 
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
        exit 2
 
esac

#授权
chmod 755 /etc/init.d/nginx
service nginx restart
代码语言:javascript复制
#查看运行日记
tail -f /usr/local/php7/var/log/php-fpm.log
代码语言:javascript复制
#杀死当前php进程,重启
killall php-fpm
php-fpm
netstat -antp | grep php-fpm
tail -f /usr/local/php7/var/log/php-fpm.log
netstat -tln | grep 9000
netstat -tln | grep 80
代码语言:javascript复制
#浏览器访问
http://IP/index.php

安装ldap扩展模块

代码语言:javascript复制
#安装ldap扩展模块
cd /opt/php-7.4.9/ext/ldap
find / -name phpize
#运行phpize
/usr/local/php7/bin/phpize
#复制库文件
cp -frp /usr/lib64/libldap* /usr/lib/
#安装至/usr/local/php7/bin/php-config
./configure --with-php-config=/usr/local/php7/bin/php-config
代码语言:javascript复制
#编译安装
make && make install
代码语言:javascript复制
#修改参数
cd /opt/php-7.4.9/
cp php.ini-production /usr/local/php7/etc/php.ini
vim /usr/local/php7/etc/php.ini

extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20190902/"
extension=ldap.so

max_execution_time = 300
post_max_size = 16M
max_input_time = 300
date.timezone = Asia/Shanghai  

银河麒麟操作系统v10是中国电子研发的操作系统,该系统充分适应5G时代需求,打通手机、平板电脑、PC等,实现多端融合。

银河麒麟操作系统V10充分适应5G时代需求,打通手机、平板电脑、PC等,实现多端融合。麒麟操作系统独创的kydroid技术,可以原生支持海量安卓应用,成功将300万余款安卓适配软硬件无缝迁移到国产平台上来。

我正在参与2023腾讯技术创作特训营第三期有奖征文,组队打卡瓜分大奖!

0 人点赞