php环境搭建

关于语言孰优孰略,吵来吵去,甚是无聊,语言是工具,语言的背后是思想,对你口,合适即可。
客观来说,php也是优秀的语言,繁荣这么多年,差不到哪。

由于一些老项目是php开发的,必须保证开发机具备PHP环境,所以这里将php环境搭建记录下

Windows

推荐使用phpstudy,下载地址

注明:phpstudy没有mac版

phpstudy直接继承了

  • Apache
  • PHP
  • .ect

通过安装该工具,直接快速搞定环境问题。

当然,XAMPP、wampserver也可以

Mac

从 OS X 10.0.0 版本开始,PHP 作为 Mac 机的标准配置被提供。原文看这里,但是如果直接浏览器访问,会报以下错误。


所以建议仍然重新安装php,执行以下命令,然后在phpstorm下进行配置即可。
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

再次浏览器访问页面,就OK了。

Apache配置

php项目运行需要在Apache下,直接配置路径,运行会报403错误,还需要一些配置,如下为修改后的配置,改动前,建议备份原配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>


DocumentRoot "/Users/juliana/newsp/testing/Test/www"
<Directory "/Users/juliana/newsp/testing/Test/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any


#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
# AllowOverride None
AllowOverride All


#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
Donate comment here