Friday 8 April 2016

Apache Interview Questions And Answers for experienced

Apache Interview Questions And Answers for experienced

Question: How to set UTF-8 for data store and fetch?
  1. Specify the utf8mb4 character set on all tables and text columns in database.
  2. While getting data from database, set the utf8 character set, like below
    $dbh = new PDO('mysql:charset=utf8mb4');
  3. Add META tag in HTML, For Example:



Question: What is difference between HTTP_HOST and SERVER_NAME?
The SERVER_NAME is defined in server config.
The HTTP_HOST is obtained from the HTTP request header.
To view SERVER_NAME and HTTP_HOST in server, use below code.
echo 'Server Name: '.$_SERVER['SERVER_NAME']; echo "\n";
echo 'HTTP HOST: '.$_SERVER['HTTP_HOST'];



Question: Difference between the Apache HTTP Server and Apache Tomcat?
Apache is HTTP server application which parse the PHP and return HTML.
Apache Tomcat is servlet container which is used to deploy your Java Servlets and JSPs.


Question: How to enable mod_rewrite for Apache 2.2?
To use rewrite mode, use following
a2enmod rewrite

then please re-start the web server.
service apache2 restart



Question: Give few tips for debugging .htaccess rules?
  1. Use a Fake-user agent.
  2. Do not use 301 until you are done testing.
  3. Remember that 301s are aggressively cached in your browser.
  4. Use a HTTP Capture tool.
  5. Use below for htacess testing: http://htaccess.madewithlove.be/ http://htaccess.mwl.be/



Question: How to give 777 permission to a folder and all contents?
chmod -R 777 .



Question: Why WAMP showing 403 Forbidden message on Windows 7?
Wrong Virtual Host configuration
http://www.web-technology-experts-notes.in/2013/04/set-up-virtual-host.html


Question: How to change port number for apache in WAMP?
  1. Open httpd.conf file, in wamp server. Location in My Computer: E:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
  2. Search "Listen 80" and replace the port number.
    Listen 80 
    to
    Listen 8080
  3. Re-Start your wamp Server



Question: What is thread safe or non thread safe in PHP?
A Thread Safe version should be used if you install PHP as an Apache module [Using WampServer/Xampp Server]. The Non Thread Safe version should be used if you install PHP as a CGI binary.


Question: Which PHP mode? Apache vs CGI vs FastCGI?
There are multiple ways to execute PHP scripts on a web server.
Following are three different way to execute the PHP.
  1. Apache:Using mod_php to execute PHP scripts on a web server. It is the most popular.
  2. CGI: Executing PHP scripts with a CGI application on a Web Server. It is the legacy way of running applications.
  3. FastCGI: FastCGI was in between the PHP Apache Module and the CGI application. It allows scripts to be executed by an interpreter outside of the web server.