最新消息:阿里云双12优惠,史上最低折扣。

1.5帝国CMS搭建教程(PHP安装文档))

服务器租用 aliyun 186浏览

1.6帝国CMS搭建教程(帝国CMS文档)

《帝国网站管理系统》英文译为"EmpireCMS",它是基于B/S结构,安全、稳定、强大、灵活的网站管理系统.本系统由帝国软件工作组独立开发,是一个经过十多年不断完善设计的适用于Linux/windows/Unix等环境下高效的网站解决方案。

PHP是我们设置的组件,它将处理代码以显示动态内容。它可以运行脚本,连接到我们的MySQL数据库以获取信息,并将处理的内容传递到我们的Web服务器以显示。

PHP-FPM(PHP FastCGI Process Manager的简称,意思是 “PHP FastCGI进程管理器” )是用于管理PHP进程池的软件,用于接收和处理来自Web服务器(例如nginx)的请求。PHP-FPM软件会创建一个主进程(通常以操作系统中根用户的身份运行),控制何时以及如何把HTTP请求转发给一个或多个子进程处理。PHP-FPM主进程还控制着什么时候创建(处理Web应用更多的流量)和销毁(子进程运行时间太久或不再需要了)PHP子进程。PHP-FPM进程池中的每个进程存在的时间都比单个HTTP请求长,可以处理10,50,100,500或更多的HTTP请求。

rpm安装php7.1相应的yum源,主要是下面两句命令

一、php7.1 yum 源

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

Retrieving https://mirror.webtatic.com/yum/el7/epel-release.rpm

warning:/var/tmp/rpm-tmp.G162nG:Header V4 RSA/SHA1 Signature, key ID 62e74ca5:NOKEY

Preparing… ################################# [100%]

package epel-release-7-11.noarch (which is newer than epel-release-7-5.noarch) is already installed

[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

warning:/var/tmp/rpm-tmp.tLfdbP:Header V4 RSA/SHA1 Signature, key ID 62e74ca5:NOKEY

Preparing… ################################# [100%]

Updating / installing…

1:webtatic-release-7-3################################# [100%]

二、yum list php71w* 相关插件

[root@localhost ~]# yumlistphp71w*

Loadedplugins: fastestmirror

Loadingmirrorspeedsfromcachedhostfile

* webtatic: us-east.repo.webtatic.com

AvailablePackages

php71w-bcmath.x86_647.1.22-1.w7webtatic

php71w-cli.x86_647.1.22-1.w7webtatic

php71w-common.x86_647.1.22-1.w7webtatic

php71w-dba.x86_647.1.22-1.w7webtatic

php71w-devel.x86_647.1.22-1.w7webtatic

php71w-embedded.x86_647.1.22-1.w7webtatic

php71w-enchant.x86_647.1.22-1.w7webtatic

php71w-fpm.x86_647.1.22-1.w7webtatic

php71w-gd.x86_647.1.22-1.w7webtatic

php71w-imap.x86_647.1.22-1.w7webtatic

php71w-interbase.x86_647.1.22-1.w7webtatic

php71w-intl.x86_647.1.22-1.w7webtatic

php71w-ldap.x86_647.1.22-1.w7webtatic

php71w-mbstring.x86_647.1.22-1.w7webtatic

php71w-mcrypt.x86_647.1.22-1.w7webtatic

php71w-mysql.x86_647.1.22-1.w7webtatic

php71w-mysqlnd.x86_647.1.22-1.w7webtatic

php71w-odbc.x86_647.1.22-1.w7webtatic

php71w-opcache.x86_647.1.22-1.w7webtatic

php71w-pdo.x86_647.1.22-1.w7webtatic

php71w-pdo_dblib.x86_647.1.22-1.w7webtatic

php71w-pear.noarch1:1.10.4-1.w7webtatic

php71w-pecl-apcu.x86_645.1.9-1.w7webtatic

php71w-pecl-apcu-devel.x86_645.1.9-1.w7webtatic

php71w-pecl-geoip.x86_641.1.1-1.w7webtatic

php71w-pecl-igbinary.x86_642.0.5-1.w7webtatic

php71w-pecl-igbinary-devel.x86_642.0.5-1.w7webtatic

php71w-pecl-imagick.x86_643.4.3-1.w7webtatic

php71w-pecl-imagick-devel.x86_643.4.3-1.w7webtatic

php71w-pecl-libsodium.x86_641.0.6-1.w7webtatic

php71w-pecl-memcached.x86_643.0.4-1.w7webtatic

php71w-pecl-mongodb.x86_641.4.1-1.w7webtatic

php71w-pecl-redis.x86_643.1.6-1.w7webtatic

php71w-pecl-xdebug.x86_642.6.0-1.w7webtatic

php71w-pgsql.x86_647.1.22-1.w7webtatic

php71w-phpdbg.x86_647.1.22-1.w7webtatic

php71w-process.x86_647.1.22-1.w7webtatic

php71w-pspell.x86_647.1.22-1.w7webtatic

php71w-recode.x86_647.1.22-1.w7webtatic

php71w-snmp.x86_647.1.22-1.w7webtatic

php71w-soap.x86_647.1.22-1.w7webtatic

php71w-tidy.x86_647.1.22-1.w7webtatic

php71w-xml.x86_647.1.22-1.w7webtatic

php71w-xmlrpc.x86_647.1.22-1.w7webtatic

三、安装php及相关插件

yuminstallphp71w.x86_64php71w-cli.x86_64php71w-common.x86_64php71w-gd.x86_64php71w-ldap.x86_64php71w-mbstring.x86_64php71w-mcrypt.x86_64php71w-mysql.x86_64php71w-pdo.x86_64

yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml

[root@localhost ~]# yum install php71w.x86_64 php71w-cli.x86_64 php71w-common.x86_64 php71w-gd.x86_64 php71w-ldap.x86_64 php71w-mbstring.x86_64 php71w-mcrypt.x86_64 php71w-mysql.x86_64 php71w-pdo.x86_64

Loaded plugins:fastestmirror

Loading mirror speeds from cached hostfile

* webtatic:uk.repo.webtatic.com

No package php71w.x86_64 available.

Resolving Dependencies

–> Running transaction check

—> Package php71w-cli.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-common.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-gd.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-ldap.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-mbstring.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-mcrypt.x86_64 0:7.1.22-1.w7 will be installed

–> Processing Dependency:libmcrypt.so.4()(64bit) forpackage:php71w-mcrypt-7.1.22-1.w7.x86_64

–> Processing Dependency:libltdl.so.7()(64bit) forpackage:php71w-mcrypt-7.1.22-1.w7.x86_64

—> Package php71w-mysql.x86_64 0:7.1.22-1.w7 will be installed

—> Package php71w-pdo.x86_64 0:7.1.22-1.w7 will be installed

–> Running transaction check

—> Package libmcrypt.x86_64 0:2.5.8-13.el7 will be installed

—> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================

Package Arch Version Repository Size

=========================================================================================================================================================================================

Installing:

php71w-cli x86_64 7.1.22-1.w7 webtatic 3.0M

php71w-common x86_64 7.1.22-1.w7 webtatic 1.2M

php71w-gd x86_64 7.1.22-1.w7 webtatic 133k

php71w-ldap x86_64 7.1.22-1.w7 webtatic 34k

php71w-mbstring x86_64 7.1.22-1.w7 webtatic 543k

php71w-mcrypt x86_64 7.1.22-1.w7 webtatic 26k

php71w-mysql x86_64 7.1.22-1.w7 webtatic 82k

php71w-pdo x86_64 7.1.22-1.w7 webtatic 89k

Installing fordependencies:

libmcrypt x86_64 2.5.8-13.el7 epel 99k

libtool-ltdl x86_64 2.4.2-22.el7_3 base 49k

Transaction Summary

=========================================================================================================================================================================================

Install 8Packages (+2Dependent packages)

Total download size:5.2M

Installed size:23M

Is this ok [y/d/N]:y

Downloading packages:

(1/10): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00:00

(2/10): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm |49kB 00:00:00

warning:/var/cache/yum/x86_64/7/webtatic/packages/php71w-ldap-7.1.22-1.w7.x86_64.rpm:Header V4 RSA/SHA1 Signature, key ID 62e74ca5:NOKEY ] 0.0B/s | 148 kB –:–:– ETA

Public key for php71w-ldap-7.1.22-1.w7.x86_64.rpm is not installed

(3/10): php71w-ldap-7.1.22-1.w7.x86_64.rpm |34kB 00:00:01

(4/10): php71w-mcrypt-7.1.22-1.w7.x86_64.rpm | 26 kB 00:00:00

(5/10): php71w-mysql-7.1.22-1.w7.x86_64.rpm |82kB 00:00:00

(6/10): php71w-pdo-7.1.22-1.w7.x86_64.rpm | 89 kB 00:00:00

(7/10): php71w-cli-7.1.22-1.w7.x86_64.rpm |3.0MB 00:00:04

(8/10): php71w-gd-7.1.22-1.w7.x86_64.rpm | 133 kB 00:00:12

(9/10): php71w-mbstring-7.1.22-1.w7.x86_64.rpm |543kB 00:01:36

(10/10): php71w-common-7.1.22-1.w7.x86_64.rpm | 1.2 MB 00:05:24

—————————————————————————————————————————————————————————————–

Total 16 kB/s |5.2MB 00:05:24

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el7

Importing GPG key 0x62E74CA5:

Userid : “Webtatic EL7 <rpms@webtatic.com>”

Fingerprint:830d b159 6d9b 9b01 99dc 24a3 e87f d236 62e7 4ca5

Package : webtatic-release-7-3.noarch (installed)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el7

Is this ok [y/N]:y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning:RPMDB altered outside of yum.

Installing : php71w-common-7.1.22-1.w7.x86_64 1/10

Installing : php71w-pdo-7.1.22-1.w7.x86_64 2/10

Installing : libmcrypt-2.5.8-13.el7.x86_64 3/10

Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 4/10

Installing : php71w-mcrypt-7.1.22-1.w7.x86_64 5/10

Installing : php71w-mysql-7.1.22-1.w7.x86_64 6/10

Installing : php71w-ldap-7.1.22-1.w7.x86_64 7/10

Installing : php71w-cli-7.1.22-1.w7.x86_64 8/10

Installing : php71w-gd-7.1.22-1.w7.x86_64 9/10

Installing : php71w-mbstring-7.1.22-1.w7.x86_64 10/10

Verifying : php71w-mysql-7.1.22-1.w7.x86_64 1/10

Verifying : php71w-ldap-7.1.22-1.w7.x86_64 2/10

Verifying : php71w-cli-7.1.22-1.w7.x86_64 3/10

Verifying : php71w-pdo-7.1.22-1.w7.x86_64 4/10

Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 5/10

Verifying : php71w-common-7.1.22-1.w7.x86_64 6/10

Verifying : php71w-gd-7.1.22-1.w7.x86_64 7/10

Verifying : php71w-mbstring-7.1.22-1.w7.x86_64 8/10

Verifying : libmcrypt-2.5.8-13.el7.x86_64 9/10

Verifying : php71w-mcrypt-7.1.22-1.w7.x86_64 10/10

Installed:

php71w-cli.x86_64 0:7.1.22-1.w7 php71w-common.x86_64 0:7.1.22-1.w7 php71w-gd.x86_64 0:7.1.22-1.w7 php71w-ldap.x86_64 0:7.1.22-1.w7 php71w-mbstring.x86_64 0:7.1.22-1.w7

php71w-mcrypt.x86_64 0:7.1.22-1.w7 php71w-mysql.x86_64 0:7.1.22-1.w7 php71w-pdo.x86_64 0:7.1.22-1.w7

Dependency Installed:

libmcrypt.x86_64 0:2.5.8-13.el7 libtool-ltdl.x86_64 0:2.4.2-22.el7_3

Complete!

四、查看安装PHP版本

[root@localhost ~]# php-v

PHP7.1.22(cli) (built: Sep15 2018 07:33:01)( NTS)

Copyright(c) 1997-2018ThePHPGroup

ZendEnginev3.1.0, Copyright(c) 1998-2018ZendTechnologies

五、yum install php71w-fpm.x86_64 还需要安装php-fpm插件

[root@localhost ~]# yum install php71w-fpm.x86_64

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* webtatic: uk.repo.webtatic.com

Resolving Dependencies

–> Running transaction check

—> Package php71w-fpm.x86_64 0:7.1.22-1.w7 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================

Package Arch Version Repository Size

=========================================================================================================================================================================================

Installing:

php71w-fpm x86_64 7.1.22-1.w7 webtatic 1.5 M

Transaction Summary

=========================================================================================================================================================================================

Install 1 Package

Total download size: 1.5 M

Installed size: 4.6 M

Is this ok [y/d/N]: y

Downloading packages:

php71w-fpm-7.1.22-1.w7.x86_64.rpm | 1.5 MB 00:00:07

Running transaction check

Running transaction test

Transaction testsucceeded

Running transaction

Installing : php71w-fpm-7.1.22-1.w7.x86_64 1/1

Verifying : php71w-fpm-7.1.22-1.w7.x86_64 1/1

Installed:

php71w-fpm.x86_64 0:7.1.22-1.w7

Complete!

六、启动php-fpm

[root@localhost ~]# systemctl start php-fpm

七、设置开机自启动(和前面mysql一样的)

[root@localhost ~]# systemctl enable php-fpm

Created symlink from/etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

八、验证是否加入开机启动列表

[root@localhost ~]# systemctl list-unit-files

php-fpm.service enabled

九、查看安装路径

[root@localhost ~]# ps -ef | grep php

root 249881016:03? 00:00:00php-fpm:master process (/etc/php-fpm.conf)

apache 2498924988016:03? 00:00:00php-fpm:pool www

apache 2499024988016:03? 00:00:00php-fpm:pool www

apache 2499124988016:03? 00:00:00php-fpm:pool www

apache 2499224988016:03? 00:00:00php-fpm:pool www

apache 2499324988016:03? 00:00:00php-fpm:pool www

root 2501324797016:06pts/000:00:00grep –color=auto php

Centos7 PHP的安装和配置

前面Nginx和httpd的安装都是为了支持PHP而弄的,然后这个目标就给了我一沉重的打击,等我慢慢道来,先来说说PHP的安装和配置吧。

一、PHP的安装

1、由于linux的yum源不存在php7.x,所以我们要更改yum源:

1

2

#rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

#rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2、yum查询安装php71w

1

#yum search php71w

3、yum 安装php71w和各种拓展,选自己需要的即可。

1

#yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml

4、安装完成之后,#whereis php 可以看到php的安装目录,然后我们来给php配置环境,实际上在centos7上php.ini已经不用像在Windows上那样配置了。我们只需要修改这个文件的参数设置cgi.fix_pathinfo,默认设置值为“1”,用;进行注释或修改为0即可。(@ _@)

1

#vim vim /etc/profile<br>在末尾添加

PATH=$PATH:/usr/local/php/bin//记得修改为自己php的安装路径

export PATH

:wq保存退出

source /etc/profile //运行该句指令使修改生效

php -v //就可以看到PHP版本信息了。

5、测试,在自己的Nginx或Apache或自建的网页目录下新建index.php,编辑内容为<?php phpinfo(); ?>

然后在网页上输入192.169.x.x:80/index.php,如果能看到php信息页面说明你的Nginx或httpd安装成功,

但我就没有这么幸运了,特别是在Nginx上。

由于Nginx对PHP的支持需要php-fpm拓展的安装和启动,然后刚开始的时候我是对php-fpm进行单独的安装和配置,启动运行systemctl start php-fpm.service systemctl start nginx,

netstat -lntp ,可以看到启动的端口和服务。

但在测试的时候,index.php总是无法解析,而是把index.php文件进行下载到本地了,很是纠结,然后我就放弃了Nginx的配置,转而配置httpd。

同样的是纠结了我好长一段时间的是,刚开是的时候httpd是能正常解析php文件的,但有段时间我把httpd服务给kill掉过后,由于不甘心又去配置Nginx,还是老样子,就又回来启动httpd,这时连httpd也都不能解析php文件了,只能访问html静态文件。而且还出现了些异常现象,后来仔细检查,在#systemctl status httpd中看到了下面错误,提示进程Process:2401启动失败。想着可能PID为2401的端口被占用,#netstat -anp –查看所有端口情况,当然没找到占用情况(无语加崩溃)。后来重启实例,重启httpd,竟然好了,(想着可能是进程启动失败或端口占用原因,我还清过缓存。具体原因还在不断摸索中,在此作个记录。)

Apache遇到的问题。

apache 不解析php

1.找到:

AddType application/x-gzip .gz .tgz

在其下面添加:

AddType application/x-httpd-php .php //添加支持对php脚本解析

2. 找到:

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

把中间那一行改为:

DirectoryIndex index.html index.htm index.php //增加对php的索引

转载请注明:小猪云服务器租用推荐 » 1.5帝国CMS搭建教程(PHP安装文档))