Hide PHP and Apache web server versions from response header

Normal PHP & Apache installations won’t hide the server details from request response headers. See below [with default configuration],

rsz_1screenshot_from_2013-10-11_071725

To hide PHP & Apache web server version details from response headers, you have to edit few configuration files on your hosted server.

 

 

After made the above changes, restart the apache web server.

 

Now check the response header from your server,

rsz_screenshot_from_2013-10-11_082700

See the difference between the response headers before and after changing the configurations.

Note: These changes won’t made your server more secure. It is just hiding the configuration details from hackers.

 

Read More

Allow cross domain XMLHttpRequest

Hi,

we can look on allowing cross domain XMLHttpRequests. To achieve this on the responding server, we need to set the header Access-Control-Allow-Origin as *.

 

Read More

Rendering MathML properly in Windows

Here, I’m going to explain about the MathML rendering in Safari browser on Windows OS. When I was worked with MathML, I faced some issues while rendering in Windows (OS: XP, Windows 7) and I found the solution for it. The solution is we have to use either STIX fonts or Asana fonts in Windows.

I have downloaded those fonts and pasted in font folder inside control panel. After done this, I again take the corresponding page which contains MathML data and verified that the data is rendering well.

To download STIX fonts click here

To download Asana fonts click here

Read More

Get contents from a file php

We can approach in two ways to get content from a file which is located in other server,

1) Using file function file_get_contents()

file_get_contents(< file URL >);

2) Using curl

For doing this by using curl, you need to add php curl library. If you are working on LAMP server, to install php curl, do as follows:

Open the terminal.

Run the command sudo apt-get install php5-curl

After execution restart your web server.

If you are on WAMP server, to install php curl library,

Open the php.ini file

Remove # in front of the php curl which you can found in extension/modules including section.

Restart your web server.

Before removing #, please ensure that the php_curl.dll file exists in installation path of WAMP server [Example – C:wampbinphpphp5.3.4ext]

Once you finished the installation of php curl library, use the code given below to get the file contents which is located in another server:

$link = '<URL>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch,CURLOPT_URL,$link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch); 

Read More

Command to clear DNS both in Linux & Windows

LINUX:

Install nscd if not present in your machine by running the following command via terminal,

sudo apt-get install nscd

To clear/flush the DNS, execute the following command,

sudo /etc/init.d/nscd restart

WINDOWS:

run the below command  via command prompt,

ipconfig/flushdns

Read More