Làm cách nào để cài đặt Apache và PHP trên Mac?

Mở trình duyệt của bạn và truy cập http. //máy chủ cục bộ. Nếu nó báo It Works, thì bạn đã thiết lập, nếu không thì hãy xem apachectl của bạn đã khởi động hay chưa

2. Kích hoạt PHP cho Apache

Hãy tạo một bản sao lưu của cấu hình Apache mặc định. Điều này sẽ giúp bạn kiểm tra chéo sau này những gì bạn đã thay đổi hoặc trong trường hợp bạn muốn khôi phục cấu hình về mặc định

cd /etc/apache2/
cp httpd.conf httpd.conf.bak

Bây giờ chỉnh sửa httpd. conf với vi hoặc bất kỳ trình soạn thảo văn bản nào khác.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
0

Bây giờ bỏ ghi chú dòng sau [Xóa #].

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
1

Bây giờ Khởi động lại apache.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
2

3. Cài đặt MySQL

Để cài đặt MySQL.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
3

Cài đặt dịch vụ sản xuất bia ngay bây giờ.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
0

Bây giờ bắt đầu MySQL.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
1

Bây giờ cấu hình MySQL.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
2

  • Xác thực plugin mật khẩu
  • Xóa người dùng ẩn danh
  • Không cho phép root đăng nhập từ xa
  • Xóa cơ sở dữ liệu thử nghiệm và truy cập vào nó
  • Tải lại các bảng đặc quyền ngay bây giờ - Chọn có

Sau khi hoàn thành việc này, hãy kiểm tra MySQL.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
3

Nó sẽ yêu cầu bạn viết mật khẩu mà bạn đã đặt cho mysql trước đó. Nhập mật khẩu và sau đó một cái gì đó như thế này xuất hiện

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
4. Kết nối PHP và MySQL

Bây giờ chúng ta cần đảm bảo PHP và MySQL

cd /var
mkdir mysql
cd mysql
ln -s /tmp/mysql.sock mysql.sock

Tất cả các trang web của bạn sẽ có các URL như http. //localhost/some-site trỏ đến /Library/WebServer/Documents/some-site

Lưu ý về Quyền

Bạn có thể nhận được 403 bị cấm khi truy cập trang web địa phương của mình. Người dùng Apache[

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
4] cần có quyền truy cập để đọc và đôi khi viết thư mục web của bạn

Bạn có thể thay đổi quyền như thế này.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
5 hoặc bạn có thể thay đổi quyền sở hữu thư mục thành người dùng và nhóm apache.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew

Copyright [c] 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
6

5. Cài đặt PHPMyAdmin

Đây là tùy chọn. Bạn có thể sử dụng MySQL thông qua dòng lệnh nhưng đây là cách tốt để quản trị MySQL. Tải xuống phpmyadmin từ trang web

Làm cách nào để bật PHP trong Apache Mac?

Chạy PHP trên máy chủ web Apache macOS / Mac OS X .
Mở một cửa sổ đầu cuối [Ứng dụng -> Tiện ích -> Thiết bị đầu cuối]
Thay đổi đúng thư mục [cd /etc/apache2]
Thay đổi quyền trên tệp [sudo chmod 755 httpd. conf]

Làm cách nào để cài đặt Apache trên máy Mac?

Cài đặt .
Cập nhật chỉ mục kho lưu trữ của homebrew. Để cài đặt Apache trên MacOS của chúng tôi, trước tiên chúng tôi cần cập nhật chỉ mục của trình cài đặt gói homebrew. .
Cài apache 2. 0. Trình cài đặt gói homebrew có thể được sử dụng để cài đặt Apache 2. 0 trên MacOS. .
bắt đầu apache. .
Dừng Apache

Làm cách nào để cài đặt Apache PHP MySQL và PHPMyAdmin trên Mac?

điều kiện tiên quyết. cài đặt homebrew. .
Kích hoạt Apache. Mở Terminal và chạy đoạn Code sau. sudo apachectl bắt đầu. .
Kích hoạt PHP cho Apache. Hãy tạo một bản sao lưu của cấu hình Apache mặc định. .
Cài đặt MySQL. Để cài đặt MySQL. bia cài đặt mysql. .
Kết nối PHP và MySQL. .
Cài đặt PHPMyAdmin

Làm cách nào để cài đặt PHP trong Mac?

Cài đặt PHP trên macOS. .
Bước 1. Sao chép lệnh cài đặt
Bước 2. Tiếp theo, dán lệnh đã sao chép vào Terminal. .
Bước 3. Bây giờ, chúng tôi sẽ nhập lệnh dưới đây để cập nhật các gói của chúng tôi. cập nhật bia. .
Note: Below, Substitute '' to the username of your macOS account..

Chủ Đề