Goals of setting up of Apache,PHP,MySQL and Magento on macOS
Overview of MAGENTO:
1.Magento is an open source e-commerce software.
2.Useful for online business requirements.
3.This has flexibility and scalability so it used for both user-friendly and search engine friendly websites.
4.Magento is a Content Management System (CMS).
System Requirements:
The system requires,
Web services requirements:
=>Apache2
=>Nginx
Database Engine Requirements:
=>MySQL8.0.33
=>MariaDB
PHP Requirements:
=>PHP and PHP extensions
Check the need version and supported version to your system requires.
1.Setup MAMP:
—>MAMP is to provide a Web Server Environment .
—>MAMP stands for M(Mac OS),A(Apache),M(MySQL),P(PHP,Perl or Python).
i)Download latest version
ii)Open and install MAMP applications
iii)setup port for apache and mysql
iv)choose apache or Nginx as a web server
2.Setup Apache:
Install Apache:
brew install httpd
To install apache:
sudo nano /usr/local/etc/httpd/httpd.conf
Check the apache configuration after installation and modify some lines ,
-Change port 8080 to 80
-Uncomment “LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so”
-Update document root “/usr/local/var/www/”
Run the apache:
sudo brew services start httpd
After start the apache move to browser and visit : “http://localhost”
3.Setup MySQL:
brew install mysql
To install mysql in Mac.
nano /Applications/MAMP/conf/my.cnf
By using this , we need to change the configuration to run the mysql
lsof -I :3306
To check the mysql port number.
mysql -u root -p
This will help us to check the mysql connection with the mysql version.While this indicates that mysql server is running successfully.
CREATE DATABASE magento:
Need to create a database for magento.
CREATE USER ‘magento’@‘127.0.0.1’ IDENTIFIES BY ‘your_password’
For magento user need to create a username and require password. Have to change ‘your_password’ to set our own password.
GRANT ALL PRIVILEGES ON *.* TO ‘magento’@‘127.0.0.1’;
mysql -u magento -p magento
CREATE USER ‘localmagento’@‘localhost’ IDENTIFIED BY ‘your_password’;
GRANT ALL PRIVILEGES ON *.* TO ‘localmagento’@‘locahost’;
Here, creating a password for localmagento setup.
mysql -u localmagento -p magento
4.Setup PHP:
brew update
This command is used of updating homebrew and packages to manage the latest version available from repository.
brew upgrade
It will upgrade PHP to the latest version.
brew install php@8.2
brew reinstall php@8.2
This command specifically install the PHP version.
brew services restart php@8.2
It will help to restart the php services after making specific changes . So need to restart the service.
php -v
To view the version of php.
5.SetUp Composer and Magento:
composer install
This will install the require composer files, libraries and packages need to run the project.
composer -v
It is used to check the version of composer.
COMPOSER_MEMORY_LIMIT = -1 composer install
Changing the memory limit of composer to not get stack with the memory and install the php dependencies for a project.
brew tap opensearch-project/homebrew-tap
Opensearch will make a new software package to make the process easier and update via homebrew tab.
brew install java
This will install the needed JDK to run the magento applications.
brew install wget
wget https://artifacts.opensearch.org/releases/bundle/opensearch/1.0.0/opensearch-1.0.0-darwin-x64.tar.gz
It is used to receive an Internet via homebrew to download files.
brew install opensearch
For installing opensearch via homebrew.
COMPOSER_MEMORY_LIMIT =-1 php bin/magentosetup:install
This installs the magento using php setup and the installation will done with all specified settings.
After this , in browser using https://admin, it will show the magento login page will be displayed.
Save and exit buttons in macOS terminal:
To edit: I(Insert)
Save : control + o , Enter
Exit : control + x
Save and exit: :wq, enter
Force quit : :q!, enter