Home  >  Article  >  Backend Development  >  Does apache support php?

Does apache support php?

(*-*)浩
(*-*)浩Original
2019-10-15 09:15:282539browse

Does apache support php?

apache supports php

php is the best server language, Apache has very strong support for php (Recommended learning: PHP video tutorial)

1. Check whether php is installed. If there is no information, then you have to install php yourself

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

Installation php, enter the command "yum install –y php" in the terminal

[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. Check again to see if it is installed. Seeing the following information proves that the installation is successful.

[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. Restart the Apache service

[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. Test php. Create a test.php file in the "/var/www/html/" directory. Then enter "127.0.0.1/test.php" in the browser

[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";
?>

You can see the following results in the browser

Does apache support php?

The above is the detailed content of Does apache support php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn