tclogo



HotelsCombined.com

Pages

Archives

Categories


Recent Postings

Recent Comments

Feeds

RSS2 feed

Links

Most Popular Posts

Archive for May 2006

The issue of empty session files

Sunday, 28th May 2006 7:20am
After installing Php everything looked like working fine until I tried to use sessions. The sessions did not work and I looked at the php.ini file and the session.save_path was clearly set to an existing folder with read/write permissions. So I checked that folder were sessions were supposed to be saved and I realised that there were two session files and one contained the correct session data and the other was empty and this clearly showed that sessions were not working.


I wrote two small scripts to test:
//first.php
<?php
session_start();
$_SESSION["session_test"] = "session testing";
print $_SESSION["session_test"]."<br>";
print '<a href = "second.php">Second Page</a><br>';
print session_id();
?>


If sessions are working properly then the session id should be the same in both pages and that offers a very simple test apart from the fact that the test string should also be shown in the second page.


The second page script looks like this:
//second.php
<?php
session_start();
print $_SESSION["session_test"]."<br>";
print session_id();
?>


On clicking the link to the second page, the second page had a different session id and the the test string never showed but instead I got this warning : Notice: Undefined index: session_test in C:\webroot\second.php on line 3. (after enabling all errors and warning to show).


After hours of toiling I found out that this issue was caused by the Zone Alarm firewall. I disabled the firewall and the sessions started working. I have looked through the firewall log and I cant see exactly where localhost or PHPSESSID is blocked and so for now I will temporarily disable the firewall when testing script involving sessions and if I cant find a solution then it could be time to move to another firewall.

delicious delicious | digg digg

Category: Php | Comments : 0

Getting Apache 2.2 to work with PHP 5

Saturday, 20th May 2006 6:50am
I decided to install Apache 2.2 and also upgrade my PHP 5 and I thought it would be a straightforward process but in the end it wasn't for reasons I am going to explain below. I am not going to write a whole tutorial on installing Apache and PHP 5 because there are already some excellent tutorials around and the one from this site I found it to be very good.


What I will do though is to highlight the small changes I made to make Apache 2.2 work with PHP 5.


Assuming PHP is installed in the C:/php folder normally you would add the following lines to your Apache httpd.conf file:


LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"


With Apache 2.2 I got an error on the LoadModule line. To resolve that error I had to download the latest stable release of PHP from the PHP Snapshots site. I downloaded the zip file for PHP 5.2 and this comes with the php5apache2_2.dll file.


In the Apache httpd conf file I then made changes to the LoadModule line as follows:


LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"


and this solved the problem. I prefer using the PHPIniDir directive because this means I just maintain one copy of the php.ini file in C:/php folder in this case and I don't have to copy another one to C:/Windows for example and this works fine for me.

delicious delicious | digg digg

Category: Php | Comments : 4

Registry Clean Up time

Wednesday, 17th May 2006 12:54pm
Once in a while I try to clean up my Windows system and optimise it a little bit. This time I was surprised that I had more than 100 registry errors or issues as they are called and most of these were caused by the applications failing to uninstall properly. There seems to be a problem nowadays that when you uninstall a program, shortcuts, icons, accompanying folder etc get deleted but if you then check the registry you still find traces of the program. This is where CCleaner becomes handy to clean up all the registry crap.


Although CCleaner can do a lot more cleaning than just resolve registry issues like delete cookies and empty recycle bin for now I will perform all those other functions manually.

delicious delicious | digg digg

Category: Windows | Comments : 0

File transfer using FileZilla

Thursday, 4th May 2006 2:18pm
I was asking a friend the other day about good and reliable FTP client software and he recommended FileZilla. FileZilla is an open source FTP client software and is available for download from SourceForge. Well, I have just been playing around with it and I have no complaints.


I have always tended to use my host's File Manager for file transfer and its alright as long as I am dealing with a few files. Unfortunately thats not always the case hence my need for good FTP client software. With FileZilla I can just copy entire folders from the local machine to the remote machine something I cant do with my host's File Manager.


You can also go ahead and rename the files and folders and perform whatever manipulation but what's exciting about it all is the speed of execution. Everything looks like its running on the local machine.


However, its a good idea to go on and make sure that the transferred files or folders have the desired permissions once they have been transferred. My test files 'lost' their permission settings after transferring and I had to reset the permissions. For example some of the files had just read only access but they ended up with read and write. Its an easy process to change file permissions though through FileZilla as this is handled quite neatly and as always its good practice to check that files and folders have permissions you intended in the first place whatever method you use for file transfer.


The C++ source code is also available for download should one want to look at the code.


I was also quite pleased with the fact that I just downloaded and installed FileZilla and it worked using the default settings. Obviously I will now start tinkering about and modify the settings to suit my particular needs.

delicious delicious | digg digg

Category: Open Source | Comments : 3