香雨站

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 79|回复: 0

Linux 软件安装 ARM64编译安装PHP教程LInux编译安装php ...

[复制链接]

1

主题

2

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2023-1-19 09:49:06 | 显示全部楼层 |阅读模式
安装相关依赖


包括gcc gcc-c++ openssl openssl-devel tar libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel freetype freetype-devel libpng libpng-devel libxslt libxslt-devel pcre pcre-devel bzip2 bzip2-devel sqlite-devel oniguruma oniguruma-devel openldap openldap-devel libicu-devel libicu
下载php安装包

wget https://www.php.net/distributions/php-7.4.30.tar.gz解压进入进行编译

[root@message php-7.4.30] cp -frp /usr/lib64/libldap* /usr/lib/
#解压安装oniguruma
[root@message oniguruma] ./configure --bindir=/usr/sbin/ \
--sbindir=/usr/sbin/ \
--libexecdir=/usr/libexec \
--sysconfdir=/etc/ \
--localstatedir=/var \
--libdir=/usr/lib64/  \
--includedir=/usr/include/ \
--datarootdir=/usr/share \
--infodir=/usr/share/info \
--localedir=/usr/share/locale \
--mandir=/usr/share/man/ \
--docdir=/usr/share/doc/onig
#解压进入文件夹编译
[root@message php-7.4.30] ./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd  --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype --with-jpeg --with-png --with-zlib  --with-libxml  --enable-xml  --disable-rpath  --enable-bcmath  --enable-shmop  --enable-sysvsem  --enable-inline-optimization  --with-curl  --enable-mbregex --enable-mbstring  --enable-intl  --with-mcrypt  --with-libmbfl  --enable-ftp  --with-gd  --enable-gd-jis-conv  --enable-gd-native-ttf  --with-openssl  --with-mhash  --enable-pcntl  --enable-sockets  --with-xmlrpc  --enable-zip  --enable-soap  --with-gettext  --disable-fileinfo  --enable-opcache  --with-pear  --enable-maintainer-zts  --with-ldap=shared  --without-gdbm
[root@message php-7.4.30] make -j4(cpu数量)
[root@message php-7.4.30] make test
[root@message php-7.4.30] make install

建立软连接



[root@message php-7.4.30]#  ln -s /usr/local/php/sbin/php-fpm /usr/local/bin
[root@message php-7.4.30]#  ln -s /usr/local/php/bin/php /usr/bin/php
#查看版本
[root@message php-7.4.30]# php -version
PHP 7.4.30 (cli) (built: Aug  3 2022 15:55:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies


生成配置文件并启动fpm

# 拷贝一个php-fpm.conf文件(这一步生成fpm的配置文件)
[root@Pi4B ~]# cd /usr/local/php/etc
[root@Pi4B ~]# cp php-fpm.conf.default php-fpm.conf
[root@Pi4B ~]# cd /usr/local/php/etc/php-fpm.d
[root@Pi4B ~]# cp www.conf.default www.conf
# 生成www.conf配置文件
[root@Pi4B ~]# cd /usr/local/php/etc/php-fpm.d
[root@Pi4B ~]# vi www.conf
# 将配置中的:
user = www
group = www
# 修改为:
user = nginx  // 需要根nginx.conf中的用户相同
group = ngixn
# 启动php-fpm
[root@Pi4B ~]# php-fpm
[root@Pi4B ~]# ps -ef|grep php-fpm
root       479 1 0 13:35 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
nginx      480 479 0 13:35 ? 00:00:00 php-fpm: pool www
nginx      481 479 0 13:35 ? 00:00:00 php-fpm: pool www
root      4943 25990 0 15:00 pts/1 00:00:00 grep --color=auto php-fpm
# 生成php.ini文件
[root@Pi4B ~] cp php.ini-production /usr/local/php/etc/php.ini
[root@Pi4B ~] vi /usr/local/php/etc/php.ini
# 修改890行,去除前面的分号,解除注释即可(在vi中使用:890跳转)
extension=mysqli
修改Nginx配置


server {
    listen       81;
    server_name  localhost;

    location / {
        root   /www/pidashboard;
        index  index.php;
}
    error_page   500 502 503 504 /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
}
    # 主要是这里,指定php文件转发
    location ~ \.php$ {
        root    /www/pidashboard;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
}
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|香雨站

GMT+8, 2025-3-15 19:39 , Processed in 0.166533 second(s), 24 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.. 技术支持 by 巅峰设计

快速回复 返回顶部 返回列表