php7.2.1与apache2.4,centos 7.2 安装PHP7.1+apache2.4.23

cp /usr/local/apache/bin/apachectl  /etc/rc.d/init.d/

mv /etc/rc.d/init.d/apachectl /etc/rc.d/init.d/httpd

chkconfig --add httpd  #所有开机模式下自启动

chkconfig httpd on  #345开机模式下自启动

安装php7

先解压(略)

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs  --with-curl  --with-freetype-dir  --with-gd  --with-gettext  --with-iconv-dir  --with-kerberos  --with-libdir=lib64  --with-libxml-dir  --with-mysqli  --with-openssl  --with-pcre-regex  --with-pdo-mysql  --with-pdo-sqlite  --with-pear  --with-png-dir  --with-xmlrpc  --with-xsl  --with-zlib  --enable-fpm  --enable-bcmath  --enable-libxml  --enable-inline-optimization  --enable-gd-native-ttf  --enable-mbregex  --enable-mbstring  --enable-opcache  --enable-pcntl  --enable-shmop  --enable-soap  --enable-sockets  --enable-sysvsem  --enable-xml  --enable-zip

出现“/replace/with/path/to/perl/interpreter: bad interpreter: No such file or

#vi  /usr/local/apache/bin/apxs

第一行的#!/replace/with/path/to/perl/interpreter -w,找到你perl的安装位置,如果不清楚,可以用which perl找到,一般在/usr/bin/perl ,于是将第一行改为:#!/usr/bin/perl -w. 再运行php的configure, 一切正常!

make && make install

安装完成后打开httpd.conf  查找php7

看是否搜索到:LoadModule php7_module modules/libphp7.so

如果没有搜索到(一般都是可以搜索到的),就将这段指令添加到httpd.conf配置文件中,使apache可以加载libphp7.so模块,并进行php文件的解析。

:wq

进行保存退出。

cd  /usr/local/apache/htdocs

按 i 键进入编辑模式,添加:

phpinfo();

?>

按Esc键回到命令模式,保存退出:

:wq

0401cbe9c36dce8f2c6c9883c7d1e7d2.png

541b37194df45d12ceadda65c533a97a.png

安装步骤如下: 1. 安装依赖包 ``` yum install -y epel-release yum install -y nginx mariadb mariadb-server php php-fpm php-mysql php-common php-mbstring php-gd php-xml php-ldap php-bcmath php-xmlrpc php-snmp php-process php-mcrypt php-opcache ``` 2. 启动并设置服务自启 ``` systemctl start nginx systemctl enable nginx systemctl start mariadb systemctl enable mariadb systemctl start php-fpm systemctl enable php-fpm ``` 3. 配置 MariaDB 数据库 ``` mysql_secure_installation mysql -u root -p ``` 在 MySQL 中创建数据库和用户: ``` create database zabbix character set utf8 collate utf8_bin; create user 'zabbix'@'localhost' identified by 'password'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; ``` 4. 安装 Zabbix Server 和 Agent 从 Zabbix 官网下载最新的源代码包:https://www.zabbix.com/download?zabbix=6.0&os_distribution=centos&os_version=7&db=MySQL ``` tar -zxvf zabbix-6.0.12.tar.gz cd zabbix-6.0.12/ ./configure --enable-server --enable-agent --with-mysql --with-libcurl --with-libxml2 --with-openssl --with-net-snmp --with-ssh2 --with-openipmi --with-jabber --prefix=/usr/local/zabbix make install ``` 5. 配置 Zabbix Server ``` cp /usr/local/zabbix/etc/zabbix_server.conf /usr/local/zabbix/etc/zabbix_server.conf.bak vi /usr/local/zabbix/etc/zabbix_server.conf ``` 修改以下内容: ``` DBName=zabbix DBUser=zabbix DBPassword=password ``` 6. 配置 PHP 和 Nginx ``` vi /etc/nginx/conf.d/zabbix.conf ``` 写入以下内容: ``` server { listen 80; server_name zabbix.example.com; root /usr/local/zabbix/frontends/php; index index.php; location / { index index.html index.htm index.php; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } ``` 7. 启动 Zabbix Server 和 Agent ``` /usr/local/zabbix/sbin/zabbix_server /usr/local/zabbix/sbin/zabbix_agentd ``` 8. 访问 Zabbix Web 界面 在浏览器中打开 `http://zabbix.example.com`,输入用户名 `Admin` 和密码 `zabbix`,进入 Zabbix Web 界面。 注意:在实际环境中,应该根据实际情况进行配置,例如修改密码、设置防火墙等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值