Page 2
4 Dec
Admin

PHP Web Development for Linux and Ubuntu- Part 2

In the first part, we learnt about Installation of PHP servers on Ubuntu. Today, we are going to discuss further about PHP web development on Linux and Ubuntu. This blog will cover the document root as well as wizard activation process.

So, let’s continue our discussion. For those who are new to the programming world, we can say that Linux and Ubuntu are two different operating systems as Windows. So, in case if your client is using linux or ubuntu then you must be aware about its development process.

For installing PHP servers needed by Ubuntu or Linux, you can refer our previous blog (Part 1) and then continue reading here to understand the process in a better way.

For those, who are aware about Ubuntu and Linux, this article will be easy to understand.

1. Defining the document root for Apache 2 HTTP Server

Document root is the directory for Apache 2 HTTP Server from which it takes files that are to be displayed in the browser. Document root is determined in the file that specifies our virtual host. By default virtual host configuration file is

/etc/apache2/sites-available/default
And with document root:
/var/www/

It is advisable to develop your own virtual host and activate it in place of editing the default one.

  • Develop a new document root location
  • Determine the new document root in new virtual host
  • Enabling the new virtual host.

So, let’s understand all these three steps in detail

  1. Developing a new document root location
    • Select Place> Home Folder
    • From the context menu, select the option Create Folder
    • Name the folder as public_html
  2. Preparing a new virtual host
    • For launching the terminal, select Applications> Accessories> Terminal. This opens the terminal window.
    • Now copy the configuration file for the default virtual host to a new file, use the below mentioned command:
      sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
    • Run the gedit application and change the new configuration file in it.
      gksudo gedit /etc/apache2/sites-available/mysite
      In case it asks for password then enter the one that was specified for the root while installing the operating system.
    • Change the document root point to the new location
      /home//public_html/
    • Replace the directory directive
      <Directory /var/www/> with
      <Directory /home/user/public_html/>
    • Save the file as mysite

    PHP Web Development
  3. Activating New Virtual Host
    • First deactivate the default host and then activate the new host, launch the terminal and use the below given utilities in Terminal Window
      sudo a2dissite default && sudo a2ensite mysite
    • Restart the Apache HTTP Server
      sudo /etc/init.d/apache2 reloadOnce this virtual host is launched and activated then comes the task of configuring MySQL database server.

2. MYSQL Server Configuration

While installing MySQL server, a root user is created. A dialog box opens during the installation process where the root user password is set. In case the dialog box doesn’t open or if the password is not set then a MYSQL root user password is to be created during configuration process.

Password is required to create other MYSQL server users.

  • Launch the terminal to connect to the MYSQL server and then enter the given command in the terminal window:
    mysql -u root –p
  • When the command prompt appears, add the following command and then give Enter:
    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
  • If the command is properly given, below mentioned message will be seen :
    Query OK, 0 rows affected (0.00 sec)

Wind Up

Once this is installed, then comes the time to install and activate Debugger which we will discuss in our coming blogs. For any further assistance related to PHP web Development, stay in touch with one of the reputed PHP Development Companies, Softqube Technologies.

Share:
Admin
Hari Patel
He is the Managing Director of Softqube Technologies Pvt. Ltd., a modern-day digital transformation, design and development service provider. We provide services to businesses of all verticals across the globe. He believe and live by a mission that he help more entrepreneurs to build, launch and grow profitable businesses.
contact
Are you looking for real talent for your dream projects?
Inquiry
We will respond you in within 24 hours
Do you have a project in mind?
Let's start your project
Quick Contact
We can give you a fast response via email, phone call or skype.
For business inquiries
Call us on
Let's Skype
Close
Inquire
Let’s make something awesome together!
Drop us a line, or give us a heads up if you’re interested in visiting us.
  • Accepted file types: docx, xlsx, ppt, pdf, jpg, gif, png.
  • 8 + 4 =
  • This field is for validation purposes and should be left unchanged.
100% secure and private