提供Discuz ,ECShop ,PHPCMS ,帝国CMS ,CSS教程 ,PHP教程 ,DedeCMS ,WordPress ,HTML教程等cms问题查询.
当前位置: 运维 > PHPstudy > phpstudy有mac版本吗,如安在Mac体系下运用phpstudy【phpstudy】,php,mac,phpstudy

背景

近来在进修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中

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

增加以后能够能够用以下敕令检察是不是准确

vagrant box list

建立Vagrantfile设置文件并运转虚拟机

新建一个目次,在目次中建立Vagrantfile 文件的内容以下

# -*- 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

然后再对应的目次中翻开终端,在终端中输入以下敕令

vagrant up && vagrant ssh

稍等片刻,虚拟机应当已建立好了,这时候体系会让输入暗码,vagrant建立的虚拟机默许暗码是vagrant 在终端中输入vagrant ,这些终端输入暗码时不会显现输入的字符,输入完以后,直接敲回车即可。到这里linux环境已设置好了。

简朴的解释一下上面的设置项是什么意义

设置运用的box为centos/7

 config.vm.box = "centos/7"

设置默许用户为root,不然默许的用户为vagrant

config.ssh.username='root'
config.ssh.password='vagrant'
config.ssh.insert_key='true'

因为与进修用的机子,这里把ip设置为静态ip 如许虚拟机跟本身电脑就是赞同局域网,能够直接互通了。

提醒: 这里的ip地点人人依据本身的电脑现实的ip来设置,ifconfig 查到细致的ip ,这里的ip设置为与其相似的,bridge 是桥接网卡的,我这里用的无线网卡,假如是用的有线衔接,请依据ifconfig查出来的值细致设置

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

到这里应当虚拟机已设置终了

装置phpstudy

把下载好的phpstudy-all.bin 放到Vagrantfile同级目次中,然后复制phpstudy-all.bin装置包到~目次

cp /vagrant/phpstudy-all.bin ~/

然后实行受权,装置

chmod +x ~/phpstudy-all.bin
~/phpstudy-all.bin

守候装置终了,依据现实情况每个人的机子装置的时候不太一样,几分钟到几十分钟都有,跟网速,另有磁盘有关联,这时候phpstudy就装置终了,装置完以后测试一下phpstudy启动是不是轻易一般

phpstudy restart

这时候可能会涌现下面毛病,这个缘由是因为没有装置psmisc,装置即可

 line 82: killall: command not found

装置psmisc

yum install psmisc

到这里phpstudy已装置设置终了,然则假如我们用来开辟的话,照样须要设置一些其他的东西,我们须要设置一下mysql能够长途接见

mysql 长途接见

照样在谁人虚拟机中运转下面的敕令上岸mysql

/phpstudy/mysql/bin/mysql -u root -proot

上岸mysql,调解当前的数据库

use mysql;

给root用户长途接见权限

grant all privileges on *.* to 'root'@'%' identified by 'root';
flush privileges;

封闭防火墙

systemctl stop firewalld

制止防火墙开机启动

systemctl disabled firewalld

到这里mysql长途衔接已开启,在mac上装置phpstudy到这里已差不多到此结束,介于篇幅,背面我们会细致讲一下怎样应用phpstorm合营phpstudy长途调试,长途布置,自动上传

引荐教程:phpStudy极速入门视频教程

以上就是phpstudy有mac版本吗,怎样在Mac体系下运用phpstudy的细致内容,更多请关注ki4网别的相干文章!

「梦想一旦被付诸行动,就会变得神圣,如果觉得我的文章对您有用,请帮助本站成长」

分享到:
赞(0) 打赏

支付宝扫一扫打赏

微信扫一扫打赏

标签:

上一篇:

下一篇:

相关推荐

0 条评论关于"phpstudy有mac版本吗,如安在Mac体系下运用phpstudy【phpstudy】,php,mac,phpstudy"

最新评论

    暂无留言哦~~

博客简介

看古风美女插画Cos小姐姐,素材合集图集打包下载:炫龙网,好看二次元插画应有尽有,唯美小姐姐等你来。

友情链接

他们同样是一群网虫,却不是每天泡在网上游走在淘宝和网游之间、刷着本来就快要透支的信用卡。他们或许没有踏出国门一步,但同学却不局限在一国一校,而是遍及全球!申请交换友链

服务热线:
 

 QQ在线交流

 旺旺在线