1、默认路由路径
2、apache配置php
-
打开
/etc/apache2/httpd.conf
文件,寻找php相关(command+F搜索php) -
在约187行的
#LoadModule php7_module libexec/apache2/libphp7.so
- 将注释符
#
删除
LoadModule php7_module libexec/apache2/libphp7.so
- 重启apache服务
sudo apachectl restart
- 在DocumentRoot路径下创建php文件,如
Info.php
写入
<?php
phpinfo();
- 打开浏览器输入url,看见如下界面即成功

3、php打印时间戳不对
在国内utc都是+8的,在/etc
文件夹下的php.ini文件中搜索timezone关键字,修改成
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/ShangHai
4、自定义域名
本地地址127.0.0.1或者localhost,那么localhost是多少呢?
进入/etc
,有一个hosts
文件
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 didideMacbook.local
255.255.255.255 broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
# This entry was appended by Docker Desktop because `localhost` did not resolve
# to a list of addresses which included 127.0.0.1. This can happen due to a bug
# in the macOS migration assistant, or possibly because another tool has
# corrupted the file.
127.0.0.1 localhost
# End of the section appended by Docker Desktop
所以localhost == 127.0.0.1
因此可以在此添加修改自己喜欢的域名,如127.0.0.1 ycc.com
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 didideMacbook.local
255.255.255.255 broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
127.0.0.1 ycc.com
# This entry was appended by Docker Desktop because `localhost` did not resolve
# to a list of addresses which included 127.0.0.1. This can happen due to a bug
# in the macOS migration assistant, or possibly because another tool has
# corrupted the file.
127.0.0.1 localhost
# End of the section appended by Docker Desktop
这样在浏览器也就可以访问自己设定的域名了