Home > Article > Backend Development > How to deploy php project to apache
How to deploy the php project to apache: first install apache and php, give permissions to the files that need to be written; then edit the httpd.conf configuration file to make apache support php; finally upload the php project to the correct Just go to the directory.
The operating environment of this article: windows10 system, php 5&&apache 2.2, thinkpad t480 computer.
If we want to deploy the php project to apache, the first thing we need to do is to install apache and php.
Install apache and php and then perform subsequent operations (take the installation path of the 63 server as an example)
First check the error message of the php project running
Path: cd /var/ log/httpd/error_log
If the error is as follows:
You can try to grant permissions to the file that needs to be written, for example:
chmod 777 ../type.json
Then edit the httpd.conf file to enable apache to support php
[root@localhost conf]# vim /etc/httpd/conf/httpd.conf
Find AddType text/html .shtml
Add at the end:
AddType application/x-httpd-php .php(使Apcche支持PHP) AddType application/x-httpd-php-source .php5
Find #ServerName www.example.com :8
Modify to: ServerName localhost:80
Find
Add
Modify the default Web site directory
Find DocumentRoot "/usr/local/apache2/htdocs"
Change to DocumentRoot " /var/www/html" --This directory is the directory you created
Find
Modify to
Then the php project package storage location: /var/www/html
Finally apche starts and stops
[root@localhost httpd]# /etc/init.d/httpd start [root@localhost httpd]# /etc/init.d/httpd stop
Related video sharing: Programming Video
The above is the detailed content of How to deploy php project to apache. For more information, please follow other related articles on the PHP Chinese website!