Enable XDebug on WAMP using Eclipse

June 7, 2011 · Posted in apache, php, Windoze · Comment 

For Windows machine running WAMPServer:

1) Install PDT plugin on your eclipse
2) Download XDebug to match your php
3) Install XDebug – save XDebug dll to wamp_path/bin/php/php5.3.5/ext folder
4) Enable XDebug – update php.ini file
4a) comment zend debugger information
4b) enable xdebug
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
; xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "path to tmp folder"
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000

5) restart apache
6) Update PHP settings on eclipse to enable XDebug

Integrate Apache 2 with Tomcat 6

January 18, 2010 · Posted in apache, general web, java, linux · Comment 

I have been trying to configure apache/tomcat is such a way that apache comes on the front-end so that I can have all the features of apache like URL rewriting, virtual hosts, PHP etc. and forward only certain requests to tomcat whose only job should be running servlets.

I have CentOS installed on my server with Apache 2 installed through yum and the goal was to install the binaries for Tomcat 6 and make them talk to each other. After some googling, the best tutorial I found to configure tomcat through mod_jk was found here. I have attached the PDF of the instructions here.
After following the steps, I was easily able to create a worker and configure apache to forward the request to /examples to tomcat.
The next issue was how to configure virtual hosts so that I can host multiple websites, some handled by apache and others through tomcat. Following is the snippet of httpd.conf setting that needs to be updated to enable virtual hosting.


NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost *:80>

ServerAdmin webmaster@lalitmehta.com
ServerName www.lalitmehta.com
ErrorLog logs/lalitmehta.com-error_log
CustomLog logs/lalitmehta-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin info@saiyam.com
ServerName rsspile.com
#   No need of DocumentRoot
ErrorLog logs/rsspile.com-error_log
CustomLog logs/rsspile.com-access_log common
JkMount /rss ajp13
JkMount /rss/* ajp13
</VirtualHost>


I do have two questions though:
1. since mod_jk.so is available for download for Linux, what advantage you get by compiling Apache and mod_jk from source? Most of the websites mention the need to compile the source. Let me know :)
2. How do I enable SSL on my server with the above configuration?

Create self signing SSL Certificate

July 10, 2009 · Posted in apache · Comment 
  1. Generate server key
    openssl genrsa -des3 -out server.key 4096
  2. Create certificate signing request
    openssl req -new -key server.key -out server.csr
  3. Sign the certificate signing request with the server key
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  4. Make the server key that does not need the password
    openssl rsa -in server.key -out server.key.insecure
  5. Do some house cleaning
    mv server.key server.key.secure
    mv server.key.insecure server.key
  6. Use the following files in apache configuration
    server.key
    server.crt

Force SSL on apache

July 10, 2009 · Posted in apache, linux · Comment 

mod rewrite should be enabled on apache. Add the following to your apache config file.

#########################################
#### XXX: BEGIN EDIT FOR MOD_REWRITE ####
#### This is intended to force HTTPS ####
#### for all inbound HTTP requests ####

####
# This module (mod_rewrite) simply tells Apache2 that all connections to
# port 80 need to go to port 443 – SSL – No exceptions
####


LoadModule rewrite_module modules/mod_rewrite.so


RewriteEngine on

####
# The line below sets the rewrite condition for mod_rewrite.so.
# That is, if the server port does not equal 443, then this condition is true
####

ReWriteCond %{SERVER_PORT} !^443$

####
# The line below is the rule, it states that if above condition is true,
# and the request can be any url, then redirect everything to https:// plus
# the original url that was requested.
####

RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

#### XXX: END EDIT FOR MOD_REWRITE ####

Enable register_global through .htaccess

June 17, 2008 · Posted in apache, php · Comment 

I would not recommend to enable register_globals, but if you need to enable the register_globals for a particular web folder, you can edit the .htaccess file and append the following to it

php_flag register_globals on

Restart apache and you are on your way.

Mounted cifs folder does not display images

June 17, 2008 · Posted in apache · Comment 

To host a test website, I had mounted a folder on my Linux server from my Vista machine.  When I opened the browser and went to the website, I was unable to view the images.  The website worked fine except the images were not showing up.  Upon a little research it turned out that I had to disable the “EnableSendfile” in my httpd.conf file.

<Directory "/path-to-nfs-files">
EnableSendfile Off
</Directory>

For more information, click here.

  • Calendar

    February 2012
    M T W T F S S
    « Jan    
     12345
    6789101112
    13141516171819
    20212223242526
    272829