Combination of apache and php on linux

 


 

This error, you need to modify the configuration file

Remove the # from the ServerName line in vim /usr/local/apache2.4.33/conf/httpd.conf

Login server and FAQ

Open the browser to log in to the server ip, and it works indicates success.

If you can't access it, try it first

  • Ping the server ip to see if it can be connected
  • Check whether the linux80 port is released. If not, you can temporarily release it with iptables -I INPUT -p tcp --dport 80 -j ACCEPT.

Add the telnet method on the window:

In Programs and Features, select Turn Windows features on or off

You can add telnet client.

Test whether port 80 is connected in cmd

This is the case.

If 403 forbidden appears

Modify the configuration file vim /usr/local/apache2.4.33/conf/httpd.conf

change to

Test configuration file syntax is correct

[root@glinux-01 src]# /usr/local/apache2.4.33/bin/apachectl -t
Syntax OK

Reload the configuration file without restarting

/usr/local/apache2.4.33/bin/apachectl graceful

Add a line to the configuration file for php parsing

AddType application/x-httpd-php .php

Add php index page index.php

Test whether the php page can be parsed

Edit 1.php under htdocs

[root@glinux-01 ~]# vim /usr/local/apache2.4.33/htdocs/1.php

Use a browser to access http://192.168.244.128/1.php, the following screen appears, indicating that the php parsing is successful

If you can't parse php, you can check the problem from the following

  • /usr/local/apache2.4.33/bin/apachectl -M to see if the php5_modele module is loaded
  • ls /usr/local/apache2.44.33/modules/libphp5.so Check if there is a libphp5.so file
  • Check if this module is loaded in the apache configuration file

  • Check if this line is added to the configuration file AddType application/x-httpd-php .php

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325479101&siteId=291194637