# [HOWTO] Setup step debugging PHP in Netbeans on Windows with XAMPP

I am using Netbeans 6.9.1 on Windows 7 with XAMPP 1.7.4 installed. I wanted to enable step debugging for PHP like I do in my PC with Fedora (see here for Netbeans PHP step debugging for Fedora). To do that, I had to follow the following steps:

Edit the php.ini file (xampp\php\php.ini) in a text editor to uncomment (remove leading semicolon 😉 the following lines:

zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000

Also, search for the line containing “xdebug.remote_enable” and change it to:

xdebug.remote_enable = On

Then restart apache service.

Now, open the file Program Files\NetBeans 6.9.1\etc\netbeans.conf and find the line containing “netbeans_default_options”. Add the text “-J-Dorg.netbeans.modules.php.dbgp.level=400” at the end of the line so that it looks like the following:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.modules.php.dbgp.level=400"

Now, restart Netbeans and select Debug>Debug Project. However, I have experienced it is very slow on Windows compared to the installation on Fedora.

Hope this helps.

# [SOLVED] Warning: imagettftext() [function.imagettftext]: Invalid font filename in path\to\php\file.php on line NN

I am running XAMPP 1.7.4 with PHP 5.3.5 on Windows 7. When using any text related GD library functions such as imagettftext(), I get the following error:

[SOLVED] Warning: imagettftext() [function.imagettftext]: Invalid font filename in path/to/php/file.php on line NN

Normally, this happens when the font is missing in GDFONTPATH and can usually be resolved by using correct font folder, using correct font file and naming it properly in the PHP file. However, in this particular case, I’ve figured that this is the problem with GD Library or PHP because I am still getting the error even though I have done everything right. I tried WAMP but still in vain. When I tried the same in my Linux machine, everything was fine.

Here is what I did as a workaround. I removed the putenv line and referred to fonts by relative path. For example, the following sample code is the one that does not work

putenv('GDFONTPATH=' . realPath('fonts'));
$font="ariali"; imagettftext($image, $size,$angle, $xcordinate,$ycordinate, $text_color,$font, $text); I have assumed that the fonts folder contains a file ariali.ttf and in that case, the code must have worked. However, it does not, so the workaround is to do the following: //putenv('GDFONTPATH=' . realPath('fonts')); remove this line$font="fonts/ariali.ttf"; //use relative path here instead
imagettftext($image,$size, $angle,$xcordinate, $ycordinate,$text_color, $font,$text);

The above code works and I guess this is how I will have to use fonts in PHP from now on.

# [SOLVED] “[ERROR] Fatal error: Can’t open and lock privilege tables: Incorrect key file for table ‘user’; try to repair it”

I am working on a computer with XAMPP installed on Windows 7. When I upgraded XAMPP to fix the earlier problem with WinMySQLAdmin, a new problem with mysql was introduced. The error log (mysql_error.log) showed the following entry at the end:

[ERROR] Fatal error: Can’t open and lock privilege tables: Incorrect key file for table ‘user’; try to repair it

To fix, I downgraded to earlier version of XAMPP, exported the database and removed the mysql data directory, and reinstalled the latest version of XAMPP. Now, MySQL could start without problems. Then, I imported the data back and all was well.

# [SOLVED] WinMySQLAdmin 1.4 : Access violation at address xxxxxx in module ‘LIBMYSQL.dll’. Read of address 00000000

I am working on a project on a Windows 7 machine with XAMPP installed. The version installed was 1.7.0 and it was showing dialog boxes with the following error:

Access violation at address xxxxxx in module ‘LIBMYSQL.dll’. Read of address 00000000

Here is one:

I tried reinstalling, but reinstallation failed because apparently mysql\bin folder was not remove during the uninstallation. So, I stopped the winmysqladmin.exe from the task manager and removed the bin folder and reinstalled again.

Then, I was able to install XAMPP. The new version of WinMySQLAdmin does not seem to have the same problem.