phpstudy有mac版本吗,如何在Mac系统下使用phpstudy


本文摘自PHP中文网,作者步履不停,侵删。

背景

最近在学习php,由于不想在环境搭建上花费太多功夫,再加上之前在linux和window上使用过phpstudy,这次在mac系统上也想使用phpstudy,可是上网查了一下,发现mac上并没有相关的phpstudy安装包,那可怎么办,刚好之前用过vagrant,virtualbox配合linux版本的phpstudy即可。有了思路,接下来看看我们需要准备什么东西来完成我们上面的想法

前置条件

1. mac os 系统

2. vagrant

3. virtualbox

4. git

5. phpstudy

6. 离线版box

开始处理

首先安装vagrant和virtualbox

下载vagrant mac版本安装包,安装直接拖到Application中即可,安装virtualbox同样的方式,

安装完之后,由于网络环境不是很好,这里就不直接使用vagrant 自己的box商店了,用自己离线下载的Centos 7 box 首先添加到 vagrant 中,命令如下

添加离线box到vagrant中

1

vagrant box add centos/7 /Users/ylf/Desktop/centos-7.0-x86_64.box

添加之后可以可以用以下命令查看是否正确

1

vagrant box list

创建Vagrantfile配置文件并运行虚拟机

新建一个目录,在目录中创建Vagrantfile 文件的内容如下

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

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

# -*- mode: ruby -*-

# vi: set ft=ruby :

 

# All Vagrant configuration is done below. The "2" in Vagrant.configure

# configures the configuration version (we support older styles for

# backwards compatibility). Please don't change it unless you know what

# you're doing.

Vagrant.configure("2") do |config|

  # The most common configuration options are documented and commented below.

  # For a complete reference, please see the online documentation at

  # https://docs.vagrantup.com.

 

  # Every Vagrant development environment requires a box. You can search for

  # boxes at https://vagrantcloud.com/search.

  config.vm.box = "centos/7"

#  config.vm.box_version = "1801.02"

 

  # Disable automatic box update checking. If you disable this, then

  # boxes will only be checked for updates when the user runs

  # `vagrant box outdated`. This is not recommended.

  # config.vm.box_check_update = false

 

  # Create a forwarded port mapping which allows access to a specific port

  # within the machine from a port on the host machine. In the example below,

  # accessing "localhost:8080" will access port 80 on the guest machine.

  # NOTE: This will enable public access to the opened port

  # config.vm.network "forwarded_port", guest: 80, host: 8080

 

  # Create a forwarded port mapping which allows access to a specific port

  # within the machine from a port on the host machine and only allow access

  # via 127.0.0.1 to disable public access

  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

 

  config.ssh.username='root'

  config.ssh.password='vagrant'

  config.ssh.insert_key='true'

 

  # Create a private network, which allows host-only access to the machine

  # using a specific IP.

  # config.vm.network "private_network", ip: "192.168.33.10"

 

  # Create a public network, which generally matched to bridged network.

  # Bridged networks make the machine appear as another physical device on

  # your network.

  # config.vm.network "public_network"

   config.vm.network "public_network" , ip: "192.168.3.233" ,bridge: "en1: Wi-Fi (AirPort)"

 

  # Share an additional folder to the guest VM. The first argument is

  # the path on the host to the actual folder. The second argument is

  # the path on the guest to mount the folder. And the optional third

  # argument is a set of non-required options.

  # config.vm.synced_folder "../data", "/vagrant_data"

 

  # Provider-specific configuration so you can fine-tune various

  # backing providers for Vagrant. These expose provider-specific options.

  # Example for VirtualBox:

  #

  # config.vm.provider "virtualbox" do |vb|

  #   # Display the VirtualBox GUI when booting the machine

  #   vb.gui = true

  #

  #   # Customize the amount of memory on the VM:

  #   vb.memory = "1024"

  # end

  #

  # View the documentation for the provider you are using for more

  # information on available options.

 

  # Enable provisioning with a shell script. Additional provisioners such as

  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the

  # documentation for more information about their specific syntax and use.

  # config.vm.provision "shell", inline: <<-SHELL

  #   apt-get update

  #   apt-get install -y apache2

  # SHELL

end

然后再对应的目录中打开终端,在终端中输入如下命令

1

vagrant up && vagrant ssh

稍等片刻,虚拟机应该已经创建好了,这时候系统会让输入密码,vagrant创建的虚拟机默认密码是vagrant 在终端中输入vagrant ,这些终端输入密码时不会显示输入的字符,输入完之后,直接敲回车即可。到这里linux环境已经配置好了。

阅读剩余部分

相关阅读 >>

PHPstudy有什么用

PHPstudy数据库忘记密码怎么办

PHPstudy apache和mysql启动后又停止的有效解决办法

PHPstudy中apache启动失败的原因是什么?

PHPstudy改端口

PHPstudy和宝塔哪个好

PHPstudy无法启动apache

PHPstudy linux 面板web后门防护功能上线

PHPstudy中怎么在数据库中存数据

PHPstudy如何配置iis服务器

更多相关阅读请进入《PHP》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...