PHPStudy is an integrated software suite for building a PHP development environment on the Windows platform. It can easily install and configure services such as Apache, PHP, and MySQL, making it simple and easy to build a PHP development environment. However, Apple computers do not support this software. How to implement PHP development using Apple computers? This article will introduce how to use PHPStudy on Apple computers.
Step 1: Install XAMPP
XAMPP is a web server environment that supports Apple computers and can be used to develop and test web applications. When using PHPStudy, we can first install XAMPP to implement support for Apache, PHP, and MySQL.
Go to https://www.apachefriends.org/index.html to download the corresponding version of XAMPP. After the installation is complete, open the terminal and enter the following command:
sudo /Applications/XAMPP/xamppfiles/xampp security
Set the MySQL password and start XAMPP.
Step 2: Install phpMyAdmin
phpMyAdmin is an open source tool for managing MySQL databases and is also integrated on PHPStudy. When using XAMPP, we need to install phpMyAdmin manually.
Enter the following command in the terminal:
cd /Applications/XAMPP/xamppfiles/www sudo curl -O https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.zip sudo unzip phpMyAdmin-4.9.4-all-languages.zip sudo mv phpMyAdmin-4.9.4-all-languages phpmyadmin
After completion, visit localhost/phpmyadmin. If the phpMyAdmin login page appears, the installation is successful.
Step 3: Configure Apache and PHP
After installing XAMPP, we need to configure the Apache and PHP environments so that they can run correctly. Enter the following command in the terminal:
cd /etc/apache2 sudo vi httpd.conf
Find the following two lines:
LoadModule php7_module libexec/apache2/libphp7.so AddHandler php7-script php
Modify them to:
LoadModule php7_module /Applications/XAMPP/xamppfiles/lib/php/libphp7.so AddHandler php7-script .php
Save and exit.
Then, we need to open the php.ini file for configuration. Enter the following command in the terminal:
cd /etc sudo cp php.ini.default php.ini sudo vi php.ini
Find the following two lines:
;extension=mysql.so ;extension=mysqli.so
Modify them to:
extension=mysql.so extension=mysqli.so
At the same time, find the following line:
;date.timezone =
Modify to:
date.timezone = Asia/Shanghai
Save and exit.
Step 4: Start Apache and MySQL
After completing the above configuration, we need to start the Apache and MySQL services. Enter the following command in the terminal:
sudo /Applications/XAMPP/xamppfiles/xampp startapache sudo /Applications/XAMPP/xamppfiles/xampp startmysql
Step 5: Add site
After completing the above steps, we need to add the site to facilitate PHP development. Enter the following command in the terminal:
cd /Applications/XAMPP/xamppfiles/etc/extra sudo vi httpd-vhosts.conf
Add the following code to the end of the file:
<VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" </VirtualHost> <VirtualHost *:80> ServerName example.com DocumentRoot "/Users/username/Documents/website" </VirtualHost>
Among them, ServerName can be replaced with the domain name you need, and DocumentRoot is the folder path to build the website locally. .
Save and exit.
Step 6: Test the PHP environment
After making the above settings, we can test the PHP environment by accessing localhost or example.com. If there are no problems, the page should display "Hello, PHP".
If a problem occurs, you can enter the following command in the terminal to view the error log and solve the problem:
tail -f /Applications/XAMPP/xamppfiles/logs/error_log
In summary, PHP development can be achieved on Apple computers in a similar way. Although unlike PHPStudy, manual configuration and installation are required, but in this way you can better understand and master the configuration and working principles of the server environment.
The above is the detailed content of A brief analysis of how to use PHPStudy on Apple computers. For more information, please follow other related articles on the PHP Chinese website!

PHPstudy Pro 是一款 Web 开发环境软件包,可快速部署和测试 Web 应用。安装步骤如下:从官方网站下载安装包。运行安装程序,选择安装路径和语言。安装完成后,启动 PHPstudy 并配置 PHP、MySQL、Apache 设置。验证安装,在浏览器输入“localhost”或运行命令“php -v”检查 PHP 版本。

phpstudy乱码是因为编码与译码的方式不一致,其解决办法:1、打开“控制面板”;2、打开“时钟,语言和区域”;3、点击“区域”;4、在小窗口上点击“管理”图标;5、点击“更改系统区域设置”,选择“具体的语言”,然后点击“确定”;6、重启电脑即可。

PHP Study安装失败可能是由于以下原因:1.系统兼容性问题;2.权限不够;3.文件冲突;4.网络连接异常;5.防病毒软件干扰;6.路径问题;7.系统错误。如遇问题无法解决,可通过PHP Study论坛、GitHub或官方网站寻求支持。

为了更改 PHPSTUDY 端口,可通过以下步骤:打开控制面板并定位到内建 Web 服务器设置;修改端口号字段中的数字;保存更改并重启服务器;输入网站 URL 及新端口号验证更改。

可以通过以下步骤修改 phpStudy 配置文件:找到配置文件(Windows:C:\Windows\phpStudy\php\php.ini;Mac:/Applications/phpStudy/php/php.ini)使用文本编辑器打开并查找要修改的设置编辑设置的值,如修改时区:date.timezone = Asia/Shanghai保存更改并重启 Apache 服务

通过 PHPstudy 查看数据库的方法包括:直接连接 MySQL 命令行使用 MySQL Workbench配置连接选择要查看的数据库通过 PHPMyAdmin在左侧菜单中选择要查看的数据库

本文涉及两款php的集成环境,这两款都含mysql + apache + php,phpstudy的功能比wamp要强大,并且十分简单容易上手。

无法安装 phpStudy 的解决方法:检查系统要求是否符合。禁用杀毒软件。关闭防火墙。以管理员身份运行安装程序。修复损坏的文件:sfc /scannow。尝试使用替代安装程序。联系 phpStudy 技术支持。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
