Skip to content

Instantly share code, notes, and snippets.

@ehzawad
Created March 14, 2016 02:54
Show Gist options
  • Save ehzawad/e5fb00e52891e7890413 to your computer and use it in GitHub Desktop.
Save ehzawad/e5fb00e52891e7890413 to your computer and use it in GitHub Desktop.
Install Apache
Apache is a free open source software which runs over 50% of the world’s web servers.
To install apache, open terminal and type in these commands:
sudo apt-get update sudo apt-get install apache2
Install MySQL
MySQL is a powerful database management system used for organizing and retrieving data To install MySQL, open terminal and type in these commands: sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
Once you have installed MySQL, we should activate it with this command: sudo mysql_install_db
Finish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
Install PHP
PHP is an open source web scripting language that is widely use to build dynamic webpages.
To install PHP, open terminal and type in this command. sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
After you answer yes to the prompt twice, PHP will install itself.
It may also be useful to add php to the directory index, to serve the relevant php index files:
sudo nano /etc/apache2/mods-enabled/dir.conf
Add index.php to the beginning of index files. The page should now look like this:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Enable required PHP modules with the following command: sudo apt-get install name of the module
Sudo apt-get install php5-cli php5-cgi
Sudo nano /var/www/html/info.php
cd /var/www/html/
sudo chmod 664 info.php
Restart apache so that all of the changes take effect:
sudo service apache2 restart
Install phpMyAdmin
The easiest way to install phpmyadmin is through apt-get:
sudo apt-get install phpmyadmin apache2-utils
During installing period you may need to set root password for phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo /etc/init.d/apache2 reload
FINALLY:
sudo php5enmod mcrypt
Restart apache:
sudo service apache2 restart
Changing var/www folder permission
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www
Enable mod rewrite
sudo a2enmod rewrite
sudo service apache2 restart
sudo nano /etc/apache2/sites-available/000-default.conf
add the following line at the end
<Directory "/var/www/html">
AllowOverride All
</Directory>
How to setup apache virtual host
please read this very detail article here
https://www.digitalocean.com/community/tutorials/how-to-set-up-apachevirtual-hosts-on-ubuntu-14-04-lts
In short:
sudo vim /etc/apache2/apache2.conf
Add these line end of the file
# Silence "Could not reliably determine the server's fully qualified domain name"
ServerName 127.0.0.1
Or
ServerName localhost
Then restart apache2
sudo service apache2 restart
sudo vim /etc/apache2/conf-available/appliance50.conf
sudo ln -s /etc/apache2/conf-available/appliance50.conf /etc/apache2/conf-enabled/appliance50.conf
“ for more read official page
How to setup xdebug
First, install XDebug, this assumes you already have a LAMP stack installed with Apache, PHP, MySQL:
• sudo apt-get install php5-xdebug
This installed the latest version, which is 2.2.3 at this time. Now update the options in PHP.INI -
/etc/php5/apache2/php.ini
• # Added for xdebug
• zend_extension="/usr/lib/php5/20121212/xdebug.so"
• xdebug.remote_enable=1
• xdebug.remote_handler=dbgp
• xdebug.remote_mode=req
• xdebug.remote_host=127.0.0.1
• xdebug.remote_port=9000
• xdebug.max_nesting_level=300
Restart Apache2, and you are ready to go!
• sudo service apache2 restart  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment