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
The above is the detailed content of Does apache support php?. For more information, please follow other related articles on the PHP Chinese website!