Dzulqarnain Nasir

  • April 23, 2011

    Tutorial: How to enable PHP5's imageantialias on Ubuntu 10.10

    I am currently working on a small project that requires me to use Apache on a Linux server. Since I am more accustomed to Ubuntu, I decided to install Ubuntu 10.10 on one of my virtual machines. So I installed everything I needed like Apache, MySQL and PHP5. Unfortunately, when I ran my PHP script, I hit a small problem. I kept getting an error 500 and it turned out that apparently the function imageantialias was not available in the PHP installation on my server.

    After a bit of research, it turned out that the GD package used in Ubuntu is different to that used in other Linux distros. I looked around for a viable solution and finally discovered that the best way to overcome this problem was to compile PHP5 from source. Here’s how I did it.

    Read more »
  • February 17, 2011

    Unresolved external 'LresultFromObject' error in RAD Studio 2010

    Recently, I’ve been working on a small service application that monitors the IIS7 server for calls to have the server restart or shutdown. The reasoning behind using a service instead of having PHP restart or shutdown the server was that PHP does not run as a user with restart/shutdown privileges. So, it became a necessity to have a service that monitors for any shutdown calls from PHP.

    I created a small service application using Embarcadero’s RAD Studio 2010 that runs as a service and checks for shutdown calls, as well as other processes. However, coming from Codegear, there were a few issues when importing an old application to be used as a base for the new application. Even after correcting all the paths that needed correction, I was getting this one error that prevented me from compiling the application.

    Read more »
  • January 21, 2011

    Tutorials: Changing the maximum upload size for IIS 7.5

    I hit a snag when uploading large files using PHP on IIS 7.5. I was getting some weird Error 404, which in most cases means the PHP script that handles the upload process was not found. I checked my server, and sure enough, the PHP script was there. I tried again to be sure, this time with a smaller file. And what do you know, it worked just fine.

    This led me to believe that there was a file size restriction imposed somewhere. I’ve already modified the php.ini file to allow me to upload larger files, but still no go. So the only other thing I can think of was IIS. Apache has something like that, so it’s only obvious that the ever-so-cautious IIS would be the same.

    After much research, and a couple of Google searches later, I found a simple solution involving some simple config file edits. Damn, after working with IIS for the past 6 months, I got used to not having to deal with config files. Anyway, the file you want to modify is C:\Windows\System32\inetsrv\config\applicationHost.config. I don’t know if it makes any difference, but I’ve converted the folders that hold my PHP scripts into Applications through the IIS Manager.

    So open that file up using any text editor. It was a newly installed virtual server, so I didn’t have anything other than Notepad available.

    Read more »
  • January 14, 2011

    PHP opendir fails with Japanese file and folder names

    I’ve been working with PHP to handle the server-side programming for a C++ application I am currently working on at work. Being a Japanese firm, it’s obvious our clients are also Japanese, thus working with Japanese file names also being obvious.

    However, lately I’ve been having problems with PHP not being able to create a handler for folders with Japanese names. PHP’s DirectoryIterator gave me an error, and opendir just fails completely. This only happens with certain Japanese characters, like the Katakana for the letter ‘ソ’ and the kanji ‘表’. Upon further research, I’ve discovered that there is a possibility that PHP’s opendir is not handling multibyte characters properly, resulting in them being misread as individual single byte characters. Shift-JIS character table reveals that the letter ‘ソ’ has a value of 0x835C. So assuming PHP is misinterpreting the multibyte character as a single byte character, it would show up as 83 and 5C.

    This is where the problem lies, because according to the ISO-8859-1 character set, 5C is the character code for the backward slash \ symbol. This becomes a problem due to the fact that Windows accepts both forward slash and backward slash as the director separator symbol. So C:\Windows can also be C:/Windows/.

    Because of this, the word “ソフトバンク” can easily be misinterpreted as “ フトバンク” and in Windows, this refers to a folder called “フトバンク” which just doesn’t exist on my server.

    Read more »
  • December 02, 2010

    Tutorial: How to install PEAR on IIS7

    I was looking around for some libraries to use in my server-side scripts and it led me to reading up on PEAR. So I decided to have a look, and install it on my Windows Server 2008 R2 server.

    I am assuming that you have properly installed PHP, and that you are using the latest version of PHP. At the time of writing, the latest PHP version is 5.3.3. You can read up on the whole installation process here.

    Read more »