Posts

    Showing posts with label apache. Show all posts
    Showing posts with label apache. Show all posts

    Saturday, 16 February 2013

    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443



    I was setting up SSL on localhost to get https://localhost. I was successfully able to get the digital signature, sign it. But when i restarted apache2 I was getting this error:

    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443

    This means that port was already being listened. Hence at first I tried to kill the processes which are using that port. When this didn't work I tried this:

    open /etc/apache2/ports.conf
    Remove the line outside any <IfModule> tag which says Listen 443

    Problem solved!!

    Saturday, 1 December 2012

    Setup apache, PHP, MySQL, phpMyAdmin on ubuntu

    Today i will show you how to setup apache, PHP, MySQL and phpMyAdmin on ubuntu

     

    Express Install

    sudo apt-get install apache2 php5 mysql-client mysql-server php5-mysql

    Then restart the apache server
    sudo /etc/init.d/apache2 restart or sudo service apache2 start

    You are done!! If you want to do it step by step do this:

    Setup apache

     

    Type this in terminal
    $ sudo apt-get install apache2

    If you find any problem at any stage try restarting the apache server like this
    $ sudo /etc/init.d/apache2 restart

    Setup PHP

    Type this in terminal
    $ sudo apt-get install php5

    Your htdocs are present in /var/www/ you have to be root to change/create files by default. To fix this
    $ sudo -i
    # cd /var/
    # umask 0000
    # chmod +rwx -R www
    # chown <your username> www
    # chgrp <your username> www
    # exit

    Note: You may have to do this sometimes in the future also

    Now edit /var/www/index.php and add anything in php
    Open browser and type localhost as url and check whether it works

    Update
    Many people asked me how to see the error log of PHP. To see use this command:

    tail -f /var/log/apache2/error.log


    Setup MySQL

    Type this in terminal
    $ sudo apt-get install mysql-client mysql-server

    Note: You will be asked to enter password for your database. Enter a password and don't forget it as it is pretty important

    Connect PHP and MySQL

    In order for PHP to access MySQL do this
    $ sudo apt-get install php5-mysql

    Setup phpMyAdmin

    Download phpMyAdmin from here.
    Now extract contents and move phpMyAdmin to /var/www/

    Open /var/www/config.sample.inc.php and change following lines

     
    /* FIND THESE LINES AND CHANGE THEM IN YOUR CONFIG FILE*/
     
    /* Authentication type */
     
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
     
    /* Server parameters */
     
    $cfg['Servers'][$i]['host'] = 'localhost';
     
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
     
    $cfg['Servers'][$i]['compress'] = false;
     
    /* Select mysql if your server does not have mysqli */
     
    $cfg['Servers'][$i]['extension'] = 'mysqli';
     
    $cfg['Servers'][$i]['AllowNoPassword'] = false;
    

    Now open localhost/phpMyAdmin on your browser