Posts

Showing posts from November, 2011

PHP extension development with Linux and Eclipse CDT. Building your environment

Image
It is hard to start with PHP extensions development in Unix environment. It is not enough to be familiar with C programming language also you need at least basic knowledge in packaging, GNU build tools and of course PHP internals. If your desktop is beautified by Linux - there is a good news for you: you don't need to setup and build everything by yourself! You just need to know how to use already configured package for your distribution. Don't even ask what to do if your desktop is crippled by Windows - play minesweeper. This post is intended to give you a good place to start. Everything is shown on example of the Opensuse 11.4, but other distributions are suitable as well. First of all we need to obtain PHP source code. Raw PHP source from php.net can be used but you will need to take care of PHP configuring and all external symbols. Delete stripped php binaries first: # zypper rm php5 next # zypper si php5 this command will download source RPM package and take care o

Curl multi hangs, connection timeout. Asynchronous DNS support

The problem. Curl is a nice library that takes advantage of asynchronous loading. Many developers use CURL in high level languages to load multiple web pages simultaneously. I use curl_multi functions very heavily in my PHP scripts too. But recently i discovered very awkward problem: CURL loads web pages asynchronously but DNS resolution is single threaded! This means that if one of the CURL handles hangs on DNS resolving other handles will hang too and wait for their turn in resolving queue! And if you set curl option "connection timeout" and DNS resolving takes more than timeout you set - all requests will fail! The solution. Starting from version 7.20.0 CURL can handle async DNS resolution using libcares. But cares support isn't enabled by default (at least in Opensuse packages and FreeBSD ports). To take advantage of async DNS resolution rebuild libcurl with --enable-ares option. If your copy of the libcurl is already compiled with async DNS support PHP will repor

Opensuse linux and D-link DWA-525 (RaLink 3060 based)

Recently i've upgraded wifi network card to D-link DWA-525 based on RaLink 3060 chipset which is wifi-N capable. But my Opensuse 11.4 wasn't able to detect it. There is two ways to solve this problem - first is to download chipset driver from ralink's site ( http://www.ralinktech.com/en/04_support/support.php?sn=501 ), setup, compile it and use. But it seems to be in a beta state because after installation it spams your logs with debug messages (can be disabled by removing -DDBG from config.mk but anyway i don't trust drivers with debug mode turned on by default). Second and proper way in my opinion is to install ralink drivers from repositories. Search for the "ralink-firmware" on  http://software.opensuse.org/search?q=ralink-firmware  and "one click install" will do all the job for you.