apache支持php
php是最好用的服务器语言了,apache对php有很强大的支持 (推荐学习:php视频教程)
1、检测是否安装php,如果什么信息也没有,那么你就要自己安装php了
[root@localhost ~]# rpm -qa | grep php
安装php,在终端输入命令“yum install –y php”
[root@localhost ~]# yum install -y phploaded plugins: fastestmirror, refresh-packagekit, securityloading 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 phpphp-cli-5.3.3-26.el6.i686php-5.3.3-26.el6.i686php-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<?php echo "hello php";?>
可以在浏览器看到以下结果
以上就是apache支持php吗的详细内容。