Configuring PHP+MySql environment under Mac OS_PHP tutorial
Configuring PHP+MySql environment under Mac OS
This article details the detailed steps for installing and configuring PHP+MySql environment under mac OS system. It is very comprehensive and is recommended here for those who have the same experience. Friends in need.
Since mantis recently needs to be deployed for bug tracking, the process is recorded here.
Since the PHP apache environment comes with Mac OS, there is no need to install the installation package elsewhere, just a simple configuration.
First open the terminal and enter the command:
The code is as follows:
sudo vim /etc/apache2/httpd.conf
There is a line like this
The code is as follows:
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the # sign in front.
Then open Sharing in System Preferences and check web sharing, as shown below
Restart apache, the command is as follows:
The code is as follows:
sudo apachectl restart
In this way, you can enter http://localhost/ in the browser, and if
appearsIt works!
Description of successfully configuring the php environment
Let’s configure the MySql environment.
First download the dmg installation package of MySql. The download address is: http://dev.mysql.com/downloads/mysql/
Open the dmg file. There are three installation items in it. I installed all three here. After MySQLStartupItem.pkg is installed, mysql will start automatically when the system starts. MySQL.prefPane indicates that the mysql option can be seen in the system preferences. , and the other one is the mysql installation item.
In this way, the installation is successful. Open mysql in the system preferences and enable the service. After installation, the default username is root and the password is empty. For security, we set a password.
Open the terminal. If you enter mysql and you are prompted that there is no such command, you need to configure the environment variables of the mysql bin directory. The directory is, /usr/local/mysql/bin/, add it to the PATH variable. Here I introduce another method,
Enter
in the terminal
The code is as follows:
sudo vim /etc/bashrc
Then add
in it
The code is as follows:
#mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
In this way, if you enter mysql in the terminal, you will have this command. In fact, it is somewhat similar to the macro definition in our C/C++, and the alias is used instead.
Then we change the root password, the command is as follows:
The code is as follows:
mysqladmin -uroot password 12345
This will change the root password to 12345.
To manage Mysql, if it is troublesome to use the command line, the open source phpMyAdmin adopts C/S mode for easy management. Then we install phpMyAdmin. It is developed by php, and the download address is: http://www.phpmyadmin.net/home_page/downloads.php
Put the downloaded unzipped file in the /Library/WebServer/Documents/ directory. The complete directory is: /Library/WebServer/Documents/phpmyadmin/, then enter this directory with the command line,
Enter the command:
The code is as follows:
cp config.sample.inc.php config.inc.php
vim config.inc.php
Make changes as follows:
The code is as follows:
$cfg['blowfish_secret'] = '';//For cookie encryption, any long string
$cfg['Servers'][$i]['host'] = '127.0.0.1';//MySQL daemon does IP binding
You can now enter the URL in your browser: http://localhost/phpmyadmin/
Server name: root
The password is the password you set.
You can log in to the mysql management interface.
Okay, the above is all about configuring the PHP+MYSQL environment in MAC OS. I hope you guys like it.

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Many Mac users tend to keep the default name of their device and may never consider changing it. Many people choose to stick with the name from the initial setup, such as "Johnny's MacBook Air" or simply "iMac." Learning how to change the name of your Mac is a very useful skill, especially when you have multiple devices, as it can help you quickly distinguish and manage them. Next, we will teach you step by step how to change the computer name, host name and Bonjour name (local host name) in macOS system. Why should you change your Mac name? Changing the name of your Mac can not only show your personality, but also help improve the user experience: Personalize your Mac: The default name may not be to your taste, change it to a name you like.

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Recently, some friends have consulted the editor about how to set up WeChat Mac to automatically convert voice messages into text. The following is a method for setting up WeChat Mac to automatically convert voice messages into text. Friends in need can come and learn more. Step 1: First, open the Mac version of WeChat. As shown in the picture: Step 2: Next, click "Settings". As shown in the picture: Step 3: Then, click "General". As shown in the picture: Step 4: Then check the option "Automatically convert voice messages in chat to text". As shown in the picture: Step 5: Finally, close the window. As shown in the picture:

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

By default, iPhone takes photos from the camera in HEIC format. HEIC stands for High Efficiency Image Container and can hold more pixel data than PNG or JPG files, taking up significantly less space on iPhone storage compared to other formats. These files work best on iPhones but are not widely accepted on the internet because they often result in blurry/grainy pictures when you share them with non-Apple devices. To ensure that HEIC images are compatible on other devices, you may need to convert them to JPG format. This article will introduce how to convert HEIC images to JPG on Mac. How to Convert HEIC Photos to JPG on Mac [3 Methods] Method

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Formatting the drive of your Mac system is crucial for proper functioning. It helps prevent various system problems and makes your Mac more stable overall. While naturally Mac supports various partitioning schemes, GUID offers more modern and versatile features compared to other options. Also essential for newer Macs and supports larger drives, giving you the best compatibility and stability. This guide will take an in-depth look at how to format a drive using a GUID on macOS. That said, let's get started. Why GUID is important for macOS installation A GUID (full form of Globally Unique Identifier) is a partitioning scheme that helps install and run the macOS operating system. It is better than traditional MBR (main lead

Ever since the Apple M4-powered OLED iPad Prolineuparrived, Apple Silicon aficionados have been eagerly awaiting the arrival of the M4 SoC on the Mac lineup. The M4 was undeniably a major leap forward in both compute and graphics performance - leapfr
