Xcode 에서 php 개발 환경 구축하기

2023. 6. 5. 21:54XCODE

1.https://brew.sh/ 에 접속해 터미널을 이용해 homebrew를 설치한다.

2.터미널에 export PATH=/opt/homebrew/bin:$PATH를 입력한다

cf)1을 한 후에 터미널에 'brew install php 을 입력하고 엔터를 칠 시

command not found 라고 뜨면 2를 행해야 하고 그렇지 않으면 2를 건너뛰어도 된다.

3.'brew install php' 을 터미널에 입력해 php 를 설치해준다.

4.터미널에 where php 라고 입력한다

5.  4를 해서 얻은 /opt/homebrew/bin/php 를 인지하자

6. 터미널에 cd /opt/homebrew/bin/ 라고 입력한다.

7. ln php boongtol_php 이라고 입력한다.(꼭 boongtol_php 가 아니여도 된다 자기 자신에게 친숙한 언어를 쓰면 된다.)

8.Xcode 에서 create a new xcode project 를 누른다

9.other 칸에 external build system 을 누른다

10.product name 과 organization identifier 에 마음에 드는 단어를 쓰고(일치시키면 좋음) build tool 칸에 5번에서 인지한 경로를 그대로 입력한다. 그리고 바탕화면에 저장한다.(create git repository on my mac 은 체크헤제한다.)

11. 왼쪽 상단에 file 란에서 new--->file 을 클릭한다. 

12. mac os 란에서 other---> empty 를 클릭한다.

13. 파일 이름을 치라고 뜰텐데 파일 이름에 10번에서 일치시키면 좋다던 단어에다가 .php 추가해 이름을 짓는다.

14. xcode에 product 란에 scheme---> edit scheme에 들어간다.

15. Run 란에 info 탭에 들어가 executable--->other 을 누른 후 command, shift, G 를 동시에 누른다.

16. 6번의 /opt/homebrew/bin/ 에 해당하는 것을 입력한다.( /opt/homebrew/bin/ 가 아닐수도 있다 개인에 맞게 하자.)

17. 7번에서 했던 친숙한 단어를 이름으로 가진 unix executable file 을 선택한다.

18. 이제 arguments 탭에 들어가서 arguments passed on launch 에서 +를 누른다.

19. 13번에서 이름을 지었던 파일 이름을 입력한다.(나의 경우에는 boongtol_php.php)

20. options 란에 working directory 에서 use custom working directory 밑에 있는 폴더 모양의 아이콘을 클릭한다.

21. 10번에서 바탕화면에 만든 폴더를 찾아 더블클릭해준다.

22. 이제 설정은 끝났다. 이제 코드를 입력하면 프로그램이 정상 작동해야 한다!

 

 

Building a php development environment in Xcode

 

1. Go to https://brew.sh/ and install the homebrew using the terminal.
2. Enter export PATH=/opt/homebrew/bin:$PATH in the terminal
After cf)1, type 'brew install php' in the terminal and hit the enter
If command not found appears, you have to do 2 or you can skip 2.
3. Enter 'brew install php' in the terminal to install php.
4. Type where php in the terminal
Recognize /opt/homebrew/bin/php obtained by doing 5.4
6. Enter cd /opt/homebrew/bin/ at the terminal.
7. Type ln php boongtol_php.(It doesn't have to be boongtol_php, but you can use a language that is familiar to you.)
In 8.Xcode, press create a new xcode project
9.In the other box, press external build system
10. Write the word you like in the product name and organization identifier (if you match it), and enter the path recognized in number 5 in the build tool box. And save it on the desktop.(create git repository on my mac is checked.)
11. Click new--->file in the file column in the upper left corner. 
12. Click other--->empty in the macos column.
13. It will say to type the file name, but to the word that says it's good to match the file name at number 10.Add php to name it.
14. In the xcode, enter the "product" section into the "system---> edit" scheme.
15. Enter the info tab in the Run column, press executable--->other, and then press command, shift, and G at the same time.
16. Enter the corresponding /opt/homebrew/bin/ number 6 (may not necessarily /opt/homebrew/bin/) Let's make it personal.)
17. Choose the unix executable file with the name of the familiar word you did in number 7.
18. Now enter the arguments tab and press + under arguments passed on launch.
19. Enter the name of the file you named in number 13.(In my case, boongtol_php.php)
20. Click the folder icon under use custom working directory in the options column.
21. Find the folder you created on the desktop at number 10 and double-click it.
22. Now the setup is over. Now when I enter the code, the program should work normally!