Showing posts with label Mac. Show all posts

Wednesday, 11 October 2017

thumbnail

How to install Apache,PHP and Mysql on MacOS-High-Sierra

Introduction

In this tutorial we are going to see how to install Apache, PHP and Mysql in Macos-High-Sierra. By default Apache, PHP comes preinstalled along the OS installation. We just need to configure it in a right way.

1. To start we need to first start the service from terminal :-

sudo apachectl start

To restart, stop and status you can use the below command:-

sudo apachectl restart
sudo apachectl stop
sudo apachectl status

2. The Document root location is given below :-

/Library/WebServer/Documents/

3. Now edit the configuration file to enable some module :-

sudo nano /etc/apache2/httpd.conf

And make sure that this module is uncommented by default 2 modules will be uncommented.

LoadModule authz_core_module libexec/apache2/mod_authz_core.so

LoadModule authz_host_module libexec/apache2/mod_authz_host.so

LoadModule userdir_module libexec/apache2/mod_userdir.so

LoadModule include_module libexec/apache2/mod_include.so

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

4. Now enable rewrite mode from httpd.conf file like below :-

sudo nano /etc/apache2/httpd.conf


Save the file and restart the Apache once to take effect.

5. Now we will see how to add PHP module to Apache :-

sudo nano /etc/apache2/httpd.conf

Uncomment the below line to load PHP module :-

LoadModule php7_module libexec/apache2/libphp7.so

Save the file and restart Apache to take effect :-

sudo apachectl restart

For testing purpose you can create a phpinfo file in the below location :-

cd /Library/WebServer/Documents/
sudo vim info.php


Test the link below :- http://localhost/info.php


6. Download and install Mysql service like below :-

https://dev.mysql.com/downloads/mysql/

Download the version your require :-


Check the Mysql Installation and configuration in below video


Download the PhpMyadmin and copy it to Document Root :-

https://www.phpmyadmin.net/downloads/

Follow the instruction like below :-

sudo cp -av phpMyAdmin-4.7.4-all-languages.zip /Library/WebServer/Documents/
cd /Library/WebServer/Documents/
sudo unzip phpMyAdmin-4.7.4-all-languages.zip
sudo mv phpMyAdmin-4.7.4-all-languages phpmyadmin
sudo chmod -R 777 phpmyadmin/
sudo apachectl restart

Now make the socket so that it can detect our phpmyadmin

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



Use the credential which you entered during mysql configuration 


That's it,
Enjoy using it 
Please do Share,Comments and Likes

Thursday, 17 December 2015

thumbnail

How-to-install-and-configure-XAMPP-Mac-OSX-Yosemite

How-to-install-and-configure-XAMPP-Mac-OSX-Yosemite

XAMPP :-
It is free, open source stack that contains Apache web server, MySQL database, PHP, and Perl. The main goal of XAMPP is to build an easy to install Apache enviroment for developers. Unlike LAMP, and LEMP stacks, It makes the developers so easy to have all packages installed at once in a couple of minutes. XAMPP is a acronym of X(Cross Platform), Apache,MySQL, PHP, and Perl.

1. First of all we need to download the XAMPP package :-

https://www.apachefriends.org/xampp-files/5.5.30/xampp-osx-5.5.30-6-installer.dmg

Download the package from the above link 

2. Now Double click on the downloaded package to install :-




In the above screen will warn for the application we are installing is of third party downloaded from internet and all. But its safe to proceed. So click on "Open"



Now we have give admin password to install the application

2. Next interactive installation will start :-



Click Next >



It will show you components which is going to be installed on your system.Please click on Next >



Afterward it will show you installation directory click Next >



Then it will show you the product you can integrate in XAMPP
Click Next >

Afterward it will open the browser and redirect you to xampp official website for their product details. So minimize the browser and continue to the installation.





The installation is started now you can wait until process finished.


As you can see the installation has been finished and you can Launch XAMPP. After you have pressed the finish button a browser will open on your localhost showing Apache information.


Now you can see in the XAMPP manager only Apache service are running. Lets start mysql server.



Check phpmyadmin on the below link :-
http://localhost/phpmyadmin



That's it now you enjoy using XAMPP
Please Do Likes,Comment and Share 

Wednesday, 16 December 2015

thumbnail

How-to-take-screenshot-from-terminal-and-automate-it-in-Linux,Mac&Windows

How to take screenshot from terminal and automate it in Linux, Mac & Windows



1. Linux 

Scrot :-
  • It is a opensource software for taking screenshot from terminal. You can change the image quality and also you can change the format of image.
  • We can capture specific area and the whole screen is well.
  • We can also automate the scrot from cron to automatically take a screen at an interval of time.
  • This utility is useful for monitoring employees desktop.
  • Scrot is available in all linux distribution like Fedora, Ubuntu, Debain,etc. 
1. To install scrot open the terminal enter the following command :-

yum install scrot -y                   For Fedora/CentOS/Redhat

sudo apt-get install scrot -y          For Ubuntu/Debian

1.1. If you wish you can install it from source code as well :-

wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz
tar -xvf scrot-0.8.tar.gz
cd /scrot-0.8
./configure
make
su -c "make install"

Redhat user need to specify the prefix location with configure command:-

./configure --prefix=/usr

1.2. How to use scrot take screenshot :-

Some of the options are as follow:-

scrot /home/techs2resolve/Desktop.jpg            Full-Screenshot
scrot -s /home/techs2resolve/Window.jpg          Selected window "scrot -s" 
scrot -q 90 /home/techs2resolve/Quality.jpg      For image quality "scrot -q"

1.3. Now we have played with it lets automate the task in the background:-

Create a file called screen.sh :-

nano screen.sh


First of all we need to create a bash script :-

#!/bin/bash
DISPLAY=:0 scrot -q 20 /home/techs2resolve/Pictures/techs2resolve-%Y-%m-%d-%H_%M.jpg


Change the permission :-

chmod 777 screen.sh

Now It is important :- You have to open your user crontab don't open it from root.

*/1 * * * * sh /home/techs2resolve/screen.sh

The above cron will run at every 1 min and the screenshot will be save inside your Pictures folder of your home directory.



2. MAC



Screencapture :-

In Mac OSX screencapture utility comes by default. Just like scrot we will do for mac with the help of scripting.

1.Go to the Finder :-

Navigate to the Applications and launch Terminal :-



2. Now create the folder on Desktop "techs2resolve" :-

mkdir ~/Desktop/techs2resolve


2.1 Now run the following script on the terminal :-

while [ 1 ];do vardate=$(date +%d\-%m\-%Y\_%H.%M.%S); screencapture -t jpg -x ~/Desktop/techs2resolve/$vardate.jpg; sleep 10; done

where 
vardate = is the variable for date and time 
jpg        = is the format to save the screenshot
~/Desktop/techs2resolve = is the location where the screenshot go
sleep     = 10 sec time duration 
done      = completes while loop

3. Now we have to automate the screenshot with "Automator" :-


 3.1 After you have launched the Automator => Select Application :



3.2 Then Goto Utilities => Double click on "Run Shell script" :-



3.3 After that paste the script here in the box :-



3.4 Now Save the file as an "app" in Documents :-





 3.5. Now lets integrate it in startup :-

Launch System Preference => Users & Group => Select User

Goto "Login Items" => 
Click on the "+" To add the app from Documents







That's it now restart your system to check service is running in your panel top right side.



That' it now enjoy using it ,
Please Do Likes,Comment and Share