Linux服务器---配置apache支持php-创新互联

apache 支持php

成都创新互联网站建设公司,提供成都做网站、成都网站建设,网页设计,建网站,PHP网站建设等专业做网站服务;可快速的进行网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,是专业的做网站团队,希望更多企业前来合作!

php 是最好用的服务器语言了,Apache对php有很强大的支持    

1 、检测是否安装php,如果什么信息也没有,那么你就要自己安装php了

[root@localhost ~]#  rpm -qa | grep php

 

2 、安装php,在终端输入命令“yum install –y php”

[root@localhost ~]#  yum install -y php

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile                                             

Dependency Installed:

  php-cli.i686 0:5.3.3-26.el6           php-common.i686 0:5.3.3-26.el6          

Complete!

[root@localhost ~]# 

 

3 、再次检测,看是否安装。看到如下信息就证明安装成功了。

[root@localhost ~]#  rpm -qa | grep php

php-cli-5.3.3-26.el6.i686

php-5.3.3-26.el6.i686

php-common-5.3.3-26.el6.i686

[root@localhost ~]# 

 

4 、重新启动Apache服务

[root@localhost ~]#  service httpd restart

停止  httpd                                                [ 确定 ]

正在启动  httpd httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

                                                          [ 确定 ]

[root@localhost ~]# 

 

5 、测试php。在“/var/www/html/”目录下创建一个test.php文件。然后在浏览器输入“127.0.0.1/test.php”

[root@localhost ~]#  cd /var/www/html/

[root@localhost html]# ls

[root@localhost html]#  touch test.php

[root@localhost html]#  gedit test.php

    echo "hello php";

?>

可以在浏览器看到以下结果

        Linux服务器---配置apache支持php

6 、安装gd库,支持php图形验证码。在终端输入命令“ yum install -y php-gd

[root@localhost ~]#  yum install -y php-gd

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

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

 Package                      Arch                       Version                            Repository                  Size

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

Installing:

 php-gd                       i686                       5.3.3-26.el6                       base                       105 k

Installing for dependencies:

 libXpm                       i686                       3.5.10-2.el6                       base                        50 k                                                                                        

Dependency Installed:

  libXpm.i686 0:3.5.10-2.el6                                                                                                

Complete!

[root@localhost ~]# rpm -qa | grep php-gd

php-gd-5.3.3-26.el6.i686

[root@localhost ~]# 

 

 

 做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
链接: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ   密码:n7bk

Linux服务器---配置apache支持php


标题名称:Linux服务器---配置apache支持php-创新互联
文章起源:http://azwzsj.com/article/djoedg.html