Home > Backend Development > PHP Problem > Does apache support php?

Does apache support php?

(*-*)浩
Release: 2023-02-26 16:50:01
Original
2578 people have browsed it

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
Copy after login

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 ~]#
Copy after login

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 ~]#
Copy after login

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 ~]#
Copy after login

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";
?>
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template