- Php Mysql Mac Os X
- Mysql Php For Mac Os Versions
- Mac Os Mysql Gui
- Mysql Php For Mac Os High Sierra
- Mysql Php For Mac Osx
I installed MySQL on my Mac OS 10.6 about a week ago, and, after some playing around, got it to work just fine. It integrated with python MySQLdb and I also got Sequel Pro to connect to the database. However, php wouldn't access the server. Mac LAMP development with MAMP (Mac OS X, Apache, MySQL, and PHP) First of all, MAMP is a terrific, free all-in-one Mac LAMP/PHP solution. Just download MAMP and install the MAMP folder in your Mac Applications folder, and you're almost ready to start your Mac/Apache/MySQL/PHP project. In fact, if you don't work from the Mac OS X command line. MySQL, a database management system, allows any user to freely collect, store, and interpret vast amounts of data on any network. MySQL will operate with any Mac operating system versions 10.2 higher. However, it's crucial to download the proper M.
Apache and PHP come packaged with OS X. To create a local web server, all you need to do is configure Apache and install MySQL.
Enable Apache on Mac OS X
To check what version of apache you have currently installed on your mac just open you terminal and type
httpd -v
Verify if apache is running by accessing http://localhost:
If you get “This site can’t be reached”, you need to start apache, just type,
sudo apachectl start
and press enter:Verify localhost again:
if you see “It works!” apache is running.
Apache Commands
You can start, stop, and restart your server by typing:
Setting up root directory
Apache’s default directory is /Library/WebServer/Documents that is where `It work’s!` file is located at.
Php Mysql Mac Os X
Move into apache users folder:
Type
ls
and check if you have a config file named after your yourusername.conf
username, if you can’t find one, that’s ok, then just type sudo nano yourusername.conf
Add this configuration to your file:
Press “Ctrl + x” to exit, “y” to save changes and hit enter.
Then to give apache permissions to read we type
sudo chmod 644 YourUserName.conf
and press enter
, lastly we type sudo apachectl restart
Done!
Mac OSX 10.8 comes with PHP 5.2 by default, in order to check what version you currently have just type
php -v
.Whatever is the current version of your PHP, go ahead and update it here.
Enable PHP
cd into Documents:
cd into apache directory:
then edit your config file:
then search “PHP” by using ctrl + w” :
Uncomment the following line (remove
#
):Now apache can serve PHP.
Configure PHP .ini
cd into /usr/local/php5/php.d
The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every invocation.
Here you can configure your time zone and other settings, just type:
Done!.
Download it from here
You don’t have to log in, just click “No thanks, just start my download”.
Run the installer.
Finish installation and set it up to be running on startup by going into your system preferences bottom line and clicking on MySQL icon, you will get a default password, save it, you will need it later.
Configure MySQL
Add MySQL to PATH
The path is a list of directories that Unix uses in order to locate programs on the machine that it can run.
If you type which php in your terminal you will get back its location:
Up until this point, MySQL has not yet been added to the path, we have to add the directory where MySQL resides to that list.
You can take a look at that list by typing:
MySQL is located at:
Now we need to add this path to PATH, just type:
We need to add this to .bash_profile:
Ctrl + x
to exit then press “y” to save changes and enter to confirm file name.Set root password
To set a new password:
If you already have a password and you want to change it, then type:
All ready!
Request–response, or request–reply, is one of the basic methods computers use to communicate with each other.
The browser sends a request for some data and apache responds to the request. Usually, there is a series of such interchanges until the complete response is sent.
This image illustrates how it works.
You can check if everything works by creating a .php file inside your /Sites directory, launch your browser and type in the address bar http://localhost/~yourusername/filename.php
Now your development environment is ready. Enjoy!
Adrian Prieto
“If you are not willing to learn, no one can help you. If you are determined to learn, no one can stop you.” ― Zig Ziglar
Latest posts by Adrian Prieto (see all)
- How To Set Up Your WordPress Development Environment with a Large Database ft. MAMP & MAC, The Really Easy Guide - April 24, 2020
- Next.js ▲ + Typescript + Storybook The Really Simple Guide 2019 - November 25, 2019
- Next.js + Styled Components The Really Simple Guide ▲ + ? - June 26, 2018
I have been always playing with the Apache, PHP, and MySQL every time but since when I switched to Mac and wanted to make a web development environment on my Mac. So the first step is to install Apache, PHP, and MySQL.
Install Apache for Mac OS
Since Mac OS is ultimately built on Unix so it is very to install any Unix supporting software. The most interesting part is that Mac OS comes with the Apache web server and we just need to start it and make some changes to setup our development environment.
Now, We need to start the apache server with root privileges to avoid permission issues.
Therefore, just launch the terminal type the command as follows:-
After starting Apache – test to see if the webserver is working in the browser – http://localhost – you should see the “It Works!” text.
Creating Apache VirtualHosts
The default location for Apache webserver project files is
/Library/WebServer/Documents/
. In this location, you all can create your application in order to host your web applications.To enable VirtualHosts, we need to make some changes in the Apache Configuration file (httpd.conf).
Make sure that you change your DocumentRoot, ServerName and Directory location according to your needs.
Now your VirtualHosts setup is done now, just restart the apache with command
Install PHP on Mac OS X
In order to install PHP, in Mac OS you will just need to enable PHP support for Apache, i.e, to need to make changes in its (httpd) configuration file.
Open httpd.conf file with the command as follows:-
Uncomment below the line and save it.
Mysql Php For Mac Os Versions
LoadModule php7_module libexec/apache2/libphp7.so
Now restart the server and it should be able to process PHP files. To test it we can create a simple PHP file as below.
Create test.php file in the /Library/WebServer/Documents/ directory with the following lines of code as shown below and save it.
Load the PHP file in browser with URL
http://localhost/test.php
and you should see a huge page with all the PHP configurations as shown below:-Congrats now you have successfully installed PHP on your Mac OS.
Installing MySql on Mac OS
Installing MySQL in Mac OS is very simple you will just have to download MySQL dmg file from the MySQL website and just press next, next in order to install.
Download the MySql DMG file from MySql Download Website.
Open the DMG file and install MySql server
Start the MySql server if it’s not running and you can find MySQL in system preferences.
Click on MySQL and you will see the screen as below:-
If you want to control MySQL through your terminal then you will have to add MySQL directory to your shell path, this is done in your “.bash_profile” file in your home directory if you don’t have that file just create it using vi or nano:
open that “.bash_profile” and add the following line and save it.
export PATH=${PATH}:/usr/local/mysql/bin/
Now, you can access MySQL through your terminal, in order to check just type the command as follows:-
Now, you have successfully connected your MySQL server through your terminal.
Mac Os Mysql Gui
If you want to change the MySQL root password then just login to MySQL and the query as follows:-
Mysql Php For Mac Os High Sierra
Change the lowercase ‘MyNewPass’ to what you want – and keep the single quotes.
Now you have successfully installed all your web development environment. If you want to GUI to manage MySQL then you can install MySQL workbench.
Mysql Php For Mac Osx
If you have any queries do post your questions in the comment section below: ?