Install httpd

ref:https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM

ref:https://dev.to/xsavitar/issue-starting-up-apache-after-upgrading-to-php-8-on-macos-2274

ref:https://blog.csdn.net/qq_44009311/article/details/105496897

ref:https://blog.csdn.net/weixin_33736649/article/details/88198840

system: centos 8

php: php 8.0.22

配置httpd

sudo vi /etc/httpd/conf/httpd.ini

添加

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

开机启动

systemctl enable httpd

启动httpd

systemctl start httpd

查看日志

/var/log/httpd/error_log

/var/log/httpd/access_log

转发到php上,php版本市8.0.22,使用php-fpm,所以httpd.conf中不需要配置AddType php之类的,可以注释掉。

关注httpd.conf底部IncludeOptional conf.d/*.conf,在httpd的conf.d(/etc/httpd/conf.d/)新建

vi /etc/httpd/conf.d/httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName vrntf.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
<Directory "/var/www/html">
    Options none
    AllowOverride none
    Require all granted
</Directory>

ErrorLog "/var/log/httpd/wp-error.log"
CustomLog "/var/log/httpd/wp-access.log" combined
</VirtualHost>

注意本实例中DocumentRoot是配置为和httpd的一致,根据需要进行调整,在安装php时设置的user,要保证php有权限访问得到。

fcgi后面的路径也必须能访问得到。

HOW TO ENABLE ZIPARCHIVE ON PHP 7.4

Install PHP from remi

I want to install php-zip, command below

yum –enablerepo=remi install -y php-zip

From:https://toggen.com.au/it-tips/how-to-enable-ziparchive-on-php-7-4/

UBUNTU / DEBIAN

Find the extension version you want to install

12345678910# install apt-get install php7.4-zip 
# enable itphpenmod -v 7.4 zip 
# check it is enabled php7.4 -i | grep -i zip
# restart any services such as php7.4-fpm.service to pick up the changesystemctl restart php7.4-fpm.service

CENTOS

12yum install php-zip# restart Apache or php-fpm

This is on CentOS Linux release 7.7.1908 (Core)

You will know you have it installed properly when you run the following code and it returns true?

123<?php// enter this in a file such as phpzip.phpvar_dump(class_exists('ZipArchive'));
12php phpzip.phpbool(true)

On CentOS using the remi-php74 repository it add a 40-zip.ini file into /etc/php.d/ with the contents of

12; Enable ZIP extension moduleextension=zip.so

centos 安装composer

from:https://blog.csdn.net/zsy16111/article/details/124427715

下载composer.phar文件

1curl -sS https://getcomposer.org/installer | php

将composer.phar移动到环境变量中并且更名为composer

1mv composer.phar  /usr/local/bin/composer

使用国内镜像

1composer config -g repo.packagist composer https://packagist.phpcomposer.com
1composer -v

centos7 安装php环境

From:https://blog.csdn.net/qq_59536202/article/details/125053130

安装apache服务

yum install httpd

开启apache服务

systemctl start httpd

设为开机自启动

systemctl enable httpd

接下来安装php

yum install -y epel-release

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm --import https://rpms.remirepo.net/RPM-GPG-KEY-remi
yum clean all
yum makecache

yum –enablerepo=remi install -y php74-php

yum –enablerepo=remi install -y php74-php php74-php-gd php74-php-xml php74-php-sockets php74-php-session php74-php-snmp php74-php-mysql

yum install -y php74-php-fpm

运行并查看版本

php74 -v

添加开机自启动

systemctl enable php74-php-fpm

链接php文件

ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php

配置文件路径

vi /etc/opt/remi/php74/php.ini

memory_limit = 512M

安装wget

yum install wget

wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

rpm –import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

安装MySQL

yum install -y –nogpgcheck mysql-community-server

启动MySQL

systemctl start mysqld

查找默认密码

grep ‘temporary password’ /var/log/mysqld.log

冒号后面的就是密码

2025-08-10T15:20:48.159182Z 1 [Note] A temporary password is generated for root@localhost: UFdw7q05g=Br

拿到登录密码登录mysql

mysql -u root -p

修改密码 刷新权限

ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码'

开启mysql远程访问并允许连接

use mysql;

UPDATE mysql.user SET Host='%' WHERE User='root';
FLUSH PRIVILEGES;

更改host并刷新权限

在关闭防火墙的状态下,现在使用navicat工具就可以连接上centos的mysql了

如果有防火墙,开放3306端口

firewall-cmd –zone=public –add-port=3306/tcp –permanent

更新防火墙规则

firewall-cmd –reload

安装完毕

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private

composer提示

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private

https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+服务器名称+2018-07-08+0803这个地址重新生成一下token,点击regenerate,复制生成的token

  然后放到auth.json文件里(文件须有写入的权限)

    "github-oauth": {
        "github.com": "这里填token"},

  保存就可以了。

  也可以用第二种方法:composer config –global –auth github-oauth.github.com token系列号

You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"

  看看auth.json文件是不是变了

  再看看composer安装是不是已经可以了

From:https://www.cnblogs.com/huanhang/p/14781986.html

php如何开启imap服务,PHP 扩展支持之 imap

From: https://blog.csdn.net/weixin_32938207/article/details/115172657

首先,进入php源码包ext目录,再进入imap目录。

[root@localhost ~]# cd imap/

[root@localhost imap]# phpize

fd95d85aa7b9d859d8739541e34f4b0f.png

再找到php-config路径

[root@localhost imap]# find / -name php-config

8f21d04684751ca329ba831800358d48.png

进行编译

[root@localhost

imap]# ./configure –with-php-config=/usr/local/php/bin/php-config

–with-kerberos –with-imap –with-imap-ssl –with-libdir=lib64

发现报错,如图

978f30cb7616a798b5769c37230d7c57.png

遇到这种报错,我要就需要安装 libc-client-devel 依赖。

[root@localhost imap]# yum -y install libc-client-devel

安装完成后,在进行编译,顺利通过,如图

968c1a75574ae198daccf65b57b54383.png

再进行make、make install

[root@localhost imap]# make

a5f9c1a686fc5541639388ce330bfb89.png

[root@localhost imap]# make install

f52a3916b80b528d7a855bee869c6b84.png

到这里,安装完成,然后编辑php.ini配置文件

[root@localhost imap]# vim /usr/local/php/etc/php.ini

再最后,加入如下三行后,重启apache、或者nginx服务

[imap]

extension_dir

=

/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/

注意:这里的路径要根据make install 后的结果填写,不要照抄

extension = imap.so

[root@localhost imap]# service httpd restart      或者  systemctl restart httpd

或者

[root@localhost imap]# service nginx restart      或者  systemctl restart nginx

两种不同的重启方式,使用哪一种,取决于安装方式,编译安装,使用前者,yum安装使用后者

重启完成之后,我们进行验证。

打开 phpinfo 网页,或是使用 php -m 查看

fb478a3448a5a18a9f8eac653c1ae88e.png
6da89edc8bcf2301da8bb5f8862d8700.png

如果有上图中所示内容,说明 php 的 iamp 扩展安装成功,否则,请检查各项配置。