1.Apache配置文件---httpd.conf
(1)Deny from all問題
<Directory />
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
原始Allow from all如果為Deny from all則需要更改。
(2)所有端口號需要一致,如:
Listen 8080
ServerName localhost:8080
需保持一致
(3)路徑為項目的路徑,我的項目文件夾為LooperWeb-master
DocumentRoot "D:\phpStudy\WWW\LooperWeb-master"
(4)學會看錯誤日志error.log,根據錯誤日志找問題。
2.phpstrom端口設置
File-->Settings-->Build,Execution,Deployment-->Debugger
image.png
端口號需跟Apache配置的端口號一致
ThinkPHP問題
運行項目出現
You don't have permission to access / on this server.
權限不足,在根目錄下創建.htaccess
文件,文件內容為
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>