Showing posts with label xampp. Show all posts
Showing posts with label xampp. Show all posts

Sunday, February 21, 2010

xampp: Compiling mod_bw.c and getting the error about undefined symbol: apr_atomic_cas

When I was compiling mod_bw.c 0.7 (apxs -i -a -c mod_bw.c) for xampp 1.7.1 on Ubuntu 9.10 and restarting lampp I was getting the following error:httpd: Syntax error on line 129 of /opt/lampp/etc/httpd.conf: Cannot load /opt/lampp/modules/mod_bw.so into server: /opt/lampp/modules/mod_bw.so: undefined symbol: apr_atomic_casThe solution was to edit the mod_bw.c and comment out or remove the following lines:#if (APR_MAJOR_VERSION < 1) #define apr_atomic_inc32 apr_atomic_inc #define apr_atomic_dec32 apr_atomic_dec #define apr_atomic_add32 apr_atomic_add #define apr_atomic_cas32 apr_atomic_cas #define apr_atomic_set32 apr_atomic_set #endifand to recompile the file.

Unfortunately, there was no difference in the file upload speed.

Sunday, December 06, 2009

Installing xdebug in xampp (lampp) on fedora 12

xdebug is a PHP extension for powerful debugging. It supports stack and function traces, profiling information and memory allocation and script execution analysis.

By default xampp-linux-1.7.1 does not come with this extension. Therefore, it is necessary to install it.

First, assuming that there is already xampp-linux-1.7.1 installed in /opt/lampp it is necessary to download xampp development package. In my case it was xampp-linux-devel-1.7.1.tar.gz and unpack it
su
tar xvfz xampp-linux-devel-1.7.1.tar.gz -C /opt


Second, install autoconf package (as a root) yum install autoconf


Thrid, xdebug can be installed (as a root)/opt/lampp/bin/pecl install xdebugIf compilation was successful you should get Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.0.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=xdebug.so" to php.ini
Finally, localization of xdebug.so should be added to php.ini. In my case, xdebug.so was in opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/. This extension should be added using "zend_extension" and not "extension", therefore, you should ignore the prompt about adding "extension=xdebug.so" to php.ini. Hance, add the following line to /opt/lampp/etc/php.ini restart your lampp server
zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
If everything went wine, using phpinfo() you should get:

Sunday, October 18, 2009

xampp / lampp: upgrade PHPUnit in lampp 1.7.1

The default PHPUnit that ships with lampp 1.7.1 is not suited for use with Zend Framework 1.9. The reason is that the PHPUnit version in lampp is to low. So it is necessary to upgrade it using pear. However, before it can be done, pear version that comes with lampp 1.7.1 needs to be also upgraded. The pear executable is in /opt/lampp/bin so I went to this folder.

First PHPUnit channel must be added sudo ./pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded


Then pear chanels can be updated sudo ./pear update-channels

Then we can try to install PHPUnit:sudo ./pear install phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version is 1.7.1
phpunit/PHPUnit requires package "pear/Image_GraphViz" (version >= 1.2.1), installed version is 1.1.0
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed


To upgrade pear I used sudo ./pear upgrade PEAR To check if upgrade was successful I used ./pear -V
PEAR Version: 1.9.0
PHP Version: 5.2.9
Zend Engine Version: 2.2.0
Running on: Linux arch 2.6.31-ARCH #1 SMP PREEMPT Tue Oct 13 13:36:23 CEST 2009 i686


Before PHPUnit can be upgraded, pear/Image_GraphViz package must be upgraded first. So sudo ./pear upgrade pear/Image_GraphViz
downloading Image_GraphViz-1.2.1.tgz ...
Starting to download Image_GraphViz-1.2.1.tgz (4,872 bytes)
.....done: 4,872 bytes
upgrade ok: channel://pear.php.net/Image_GraphViz-1.2.1

and install PHPUnit ./pear install -a phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.4.1.tgz ...
Starting to download PHPUnit-3.4.1.tgz (326,659 bytes)
...................................................................done: 326,659 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.4.1

After this, when I could use PHPUnit with Zend Framework as described in a tutorial here.

Wednesday, October 07, 2009

Xampp: SQLSTATE[HY000] [2002] Invalid argument

I'm currently developing a web application using Zend Framework 1.9.x. For this purpose I used Xampp for linux (i.e. lampp 1.7.2). Most of the time I was using arch linux with xampp 1.7.2 and there was no problem. Then I changed my os to Ubuntu 9.04 and I installed the same xampp 1.7.2. Interestingly, when I wanted to run my application under Ubuntu I got an errorMessage: SQLSTATE[HY000] [2002] Invalid argumentAfter googling I found that the reason was that in my php.ini (i.e. for xampp it is /opt/lampp/etc/php.ini) the variable pdo_mysql.default_socket was not set: Therefore I set it to /opt/lampp/var/mysql/mysql.sockOf course, I also had to restart Xamppsudo /opt/lampp/lampp restartIt is interesting why Xampp 1.7.2 worked under Arch Linux, but it did not work under Ubuntu 9.04?

Sunday, February 01, 2009

CakePHP: Image Upload

Searching the web for some image upload component for cakePHP I found the following article: Image Upload Component (CakePHP) - Labs. Although this article is very useful, it was written over a year ago and unfortunately, the code of the image upload component available for download did not work straight away for me (I tested it using CakePHP 1.2.1.8004 Stable on xampp 1.7 for linux on Ubuntu 8.10). Some problems were: lack of index action in images controller, some unknown helpers (i.e. labelTag), missing model for images table, typo errors in view file upload.thtml, id field in images table was not a primary key, and some others. Three example screenshots are below:



Therefore, to make this component work I had to perform some modifications. Although, this component can be improved in may ways, I only made modifications necessary to make this component work. I did not perform full test of this componet. I just made it work, i.e. it is possible to upload images now (at least for me now).

Download

The modified image upload component is here. Hope it works and it will be useful. In a similar way I also modified component for the multiple file upload. It can be downloaded from here.

Tuesday, January 13, 2009

Prado framework: problems running demo applications

PRADO is a component-based and event-driven programming framework for developing web applications in PHP5. Beginners wanting to learn Prado may have problems when they want to run demo applications on their own server. Some demos simply don't work. Particular, I had problems on xampp 1.7 for Windows with AJAX Chat, address-book and northwind-db demos. The problem is that they use sqlite3 database and they require pdo_sqlite and php_pdo_sqlite PHP extensions. However, the PHP in xampp 1.7 for Windows(PHP 5.2.8) a comes with these extensions for only sqlite2, not sqlite3!. For that reason when I tried to run e.g. AJAX Chat demo I got the "DbConnection failed to establish DB connection: could not find drive" error:
The solution to this problem was, at least for me, to convert sqlite3 databases of these demos to sqlite2.

AJAX Chat demo

The online example of this demo is here. As previously indicated, when I wanted to use the demo I was greeted with DbConnection error. This indicates that there is some problem with database connections. AJAX Chat demo requires pdo_sqlite extensions. So first thing that I did was to check if my PHP has such extensions. Before proceeding I made sure that these extensions were enabled in php.ini or php5.ini. To check if I have these extensions I used <?PHP phpinfo();?>. These resulted, among other things, with the following:This cleary shows that my pdo_sqlite driver is sqlite2. For that reason I converted the chat.db database of the AJAX Chat demo from sqlite3 to sqlite2 as follows:sqlite3 chat.db .dump | sqlite chat2.dbNext, in application.xml I made the following change from to
Following these changes the AJAX Chat demo finally worked:

Address-book demo

Online demo is here. The problem with this demo was the same as with the AJAX Chat demo, i.e. sqlite database. Since the demo uses Flex the error message was little different:To make it work, I converted the demo's sqlite3 database to sqlite2 database as follows:sqlite3 sqlite.db .dump | sqlite sqlite2.db. Next application.xml was modified as before and the demo worked:

northwind-db demo

The problem with this demo is the same as before. However, this time converting sqlite3 database to sqlite2 database resulted in errors. In another worlds, I could not convert the demo's database. The reason was that the demo's database is much more complicated than that of address-book and chat demos, and sqlite2 returned syntex errors when dumping. At the moment I'm still analyzing AJAX Chat demo, so northwind-db demo is far ahead. When and if I get to it, I try to find some solution this problem.

Download of chat2.db and sqlite2.db

The two sqlite database created are here.