How to deploy php project to apache

王林
Release: 2023-03-10 12:52:01
Original
4603 people have browsed it

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.

How to deploy php project to apache

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:

How to deploy php project to apache

You can try to grant permissions to the file that needs to be written, for example:

chmod 777 ../type.json
Copy after login

Then edit the httpd.conf file to enable apache to support php

[root@localhost conf]# vim /etc/httpd/conf/httpd.conf
Copy after login

Find AddType text/html .shtml

Add at the end:

AddType application/x-httpd-php .php(使Apcche支持PHP) AddType application/x-httpd-php-source .php5
Copy after login

Find #ServerName www.example.com :8

Modify to: ServerName localhost:80

Find DirectoryIndex index.html

Add DirectoryIndex index .html index.php

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

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!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!