首頁 運維 phpstudy phpstudy有mac版本嗎,如何在Mac系統下使用phpstudy

phpstudy有mac版本嗎,如何在Mac系統下使用phpstudy

Jun 10, 2019 pm 01:37 PM
mac php phpstudy

phpstudy有mac版本嗎,如何在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=&#39;root&#39;
config.ssh.password=&#39;vagrant&#39;
config.ssh.insert_key=&#39;true&#39;
登入後複製

由於與學習用的機子,這裡把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 &#39;root&#39;@&#39;%&#39; identified by &#39;root&#39;;
flush privileges;
登入後複製
###關閉防火牆###
systemctl stop firewalld
登入後複製
###禁止防火牆開機啟動###
systemctl disabled firewalld
登入後複製
###到這裡mysql遠端連線已經開啟,在mac上安裝phpstudy到這裡已經差不多到此結束,介於篇幅,後面我們會具體講一下如何利用phpstorm配合phpstudy遠端調試,遠端部署,自動上傳######推薦教學:######phpStudy極速入門影片教學##########

以上是phpstudy有mac版本嗎,如何在Mac系統下使用phpstudy的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

適用於 Ubuntu 和 Debian 的 PHP 8.4 安裝和升級指南 適用於 Ubuntu 和 Debian 的 PHP 8.4 安裝和升級指南 Dec 24, 2024 pm 04:42 PM

PHP 8.4 帶來了多項新功能、安全性改進和效能改進,同時棄用和刪除了大量功能。 本指南介紹如何在 Ubuntu、Debian 或其衍生版本上安裝 PHP 8.4 或升級到 PHP 8.4

如何設定 Visual Studio Code (VS Code) 進行 PHP 開發 如何設定 Visual Studio Code (VS Code) 進行 PHP 開發 Dec 20, 2024 am 11:31 AM

Visual Studio Code,也稱為 VS Code,是一個免費的原始碼編輯器 - 或整合開發環境 (IDE) - 可用於所有主要作業系統。 VS Code 擁有大量針對多種程式語言的擴展,可以輕鬆編寫

您如何在PHP中解析和處理HTML/XML? 您如何在PHP中解析和處理HTML/XML? Feb 07, 2025 am 11:57 AM

本教程演示瞭如何使用PHP有效地處理XML文檔。 XML(可擴展的標記語言)是一種用於人類可讀性和機器解析的多功能文本標記語言。它通常用於數據存儲

php程序在字符串中計數元音 php程序在字符串中計數元音 Feb 07, 2025 pm 12:12 PM

字符串是由字符組成的序列,包括字母、數字和符號。本教程將學習如何使用不同的方法在PHP中計算給定字符串中元音的數量。英語中的元音是a、e、i、o、u,它們可以是大寫或小寫。 什麼是元音? 元音是代表特定語音的字母字符。英語中共有五個元音,包括大寫和小寫: a, e, i, o, u 示例 1 輸入:字符串 = "Tutorialspoint" 輸出:6 解釋 字符串 "Tutorialspoint" 中的元音是 u、o、i、a、o、i。總共有 6 個元

在PHP API中說明JSON Web令牌(JWT)及其用例。 在PHP API中說明JSON Web令牌(JWT)及其用例。 Apr 05, 2025 am 12:04 AM

JWT是一種基於JSON的開放標準,用於在各方之間安全地傳輸信息,主要用於身份驗證和信息交換。 1.JWT由Header、Payload和Signature三部分組成。 2.JWT的工作原理包括生成JWT、驗證JWT和解析Payload三個步驟。 3.在PHP中使用JWT進行身份驗證時,可以生成和驗證JWT,並在高級用法中包含用戶角色和權限信息。 4.常見錯誤包括簽名驗證失敗、令牌過期和Payload過大,調試技巧包括使用調試工具和日誌記錄。 5.性能優化和最佳實踐包括使用合適的簽名算法、合理設置有效期、

我後悔之前不知道的 7 個 PHP 函數 我後悔之前不知道的 7 個 PHP 函數 Nov 13, 2024 am 09:42 AM

如果您是經驗豐富的PHP 開發人員,您可能會感覺您已經在那裡並且已經完成了。操作

解釋PHP中的晚期靜態綁定(靜態::)。 解釋PHP中的晚期靜態綁定(靜態::)。 Apr 03, 2025 am 12:04 AM

靜態綁定(static::)在PHP中實現晚期靜態綁定(LSB),允許在靜態上下文中引用調用類而非定義類。 1)解析過程在運行時進行,2)在繼承關係中向上查找調用類,3)可能帶來性能開銷。

什麼是PHP魔術方法(__ -construct,__destruct,__call,__get,__ set等)並提供用例? 什麼是PHP魔術方法(__ -construct,__destruct,__call,__get,__ set等)並提供用例? Apr 03, 2025 am 12:03 AM

PHP的魔法方法有哪些? PHP的魔法方法包括:1.\_\_construct,用於初始化對象;2.\_\_destruct,用於清理資源;3.\_\_call,處理不存在的方法調用;4.\_\_get,實現動態屬性訪問;5.\_\_set,實現動態屬性設置。這些方法在特定情況下自動調用,提升代碼的靈活性和效率。

See all articles