Tuesday, September 20, 2011
how to compile php on windows / win32
create a folder on your c drive, like C:\PHPDEV
download php 5.2.6 source from a mirror (this is the current php 5 version, time of this post). Save this tar.gz file into C:\PHPDEV. EXTRACT IT THERE.
download php win32 build extras and save into C:\PHPDEV. EXTRACT IT THERE.
Get pre-built binary packages for bison.exe and flex.exe. Put those on your desktop, or somewhere AWAY from C:\PHPDEV.
Open both archives and go into their /bin directories. Take flex.exe from the flex archive and bison.exe from the bison archive and put THOSE into C:\PHPDEV.
The next step can get twisted if you don’t have Visual Studio (any version?) installed.
If you don’t have it, try the express editions, or take a look at ishouldbecoding.com article.
Assuming you have Visual Studio 2008, FIRST, open C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat.
The file is about 50 lines long full of @set type statements.
Find the line that starts with
@set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;(goes on)
Change that line to read
@set PATH=C:\PHPDEV;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;(leave the rest exactly as it were)
So all I did there was add C:\PHPDEV; just after the = sign. The reason I did that was so that flex.exe and bison.exe are part of the system path now.
NOW, go to Start->Microsoft Visual Studio 2008->Visual Studio Tools->Visual Studio 2008 Command Prompt.
switch to C:\PHPDEV\php-5.2.6
type buildconf.bat
What this does is scan all folders for .w32 files and creates configure.js for you
type:
cscript /nologo configure.js --without-xml --without-wddx --without-simplexml --without-dom --without-libxml --disable-zlib --without-sqlite --disable-odbc --disable-cgi --enable-cli --enable-debug --without-iconv --disable-ipv6
**** COPY PASTE THE ABOVE LINE. ITS LONGER THAN IT LOOKS.
what this does is modify configure.js for you. You can get the same effect I guess by going into configure.js and manually setting things to “yes” and “no”. Why disable all these things? Most of these aren’t included in the bundle you downloaded, so you’d get compile errors like “file not found” if you didn’t disable these.
if you don’t have bison.exe, you’ll get:
ERROR: bison is required
If you don’t have flex.exe, you’ll get
ERROR: flex is required
so get bison and flex as explained above.
Type
nmake
switch to c:\PHPDEV\php-5.2.6\Debug_TS
Type something like
php -r “$x = ‘hello’; echo($x);”
Friday, April 15, 2011
How To Setup A DNS Server In Ubuntu
Overview
Would you like to setup a DNS Server in Ubuntu? How about setting up a private internal domain name at home? Well, you’ve come to the right place. There are number of tutorials on the internet showing you how to setup a DNS Server with Ubuntu using Bind 9. So, why another how-to document? That’s a good question. I’ve decided I needed to write a simple tutorial that anyone with a little bit of Linux knowledge would be able to follow. In the process, I hope readers are also able to learn how DNS works. Ok, let’s jump right to it!
What is DNS?
First of all, let’s cover the basics. What is DNS? DNS stands for Domain Name Server. It’s a service that runs on a server that translates humanly recognizable domain names such as www.yahoo.com or www.google.com into its assigned IP addresses. If the DNS server does not recognize the domain name being requested, it will forward the domain name request to another DNS server and so on until the name is resolved.
A typical DNS request is when someone is accessing a website. Let’s use the www.yahoo.com domain as an example. When a user clicks a Yahoo link or types the Yahoo URL on the address bar of the browser, the DNS server processes the domain request. If it doesn’t find www.yahoo.com on its DNS table, it will forward the request to another DNS server with a higher authority and so on until it finds a server with the URL entry. The IP address information is then sent back to the user’s browser. If the domain name is not found, a “server not found” message is displayed on the browser.
Assumptions
Enough with the DNS background. Let’s now start configuring our own DNS server. Let’s assume that we have the following: we want to create a private internal domain name called mydomain.com, our private internal network is192.168.0.x and our router and gateway is set at 192.168.0.1. Let’s assume all devices are going to be configured with static IP addresses. Normally, most computer systems nowadays are configured to automatically obtain IP addresses from the DHCP server/router. In this example, we will use static IP addresses to show how DNS works. Finally, we have 3 computers connected to our network:
- Ubuntu Server, the DNS server – 192.168.0.9
- Ubuntu Desktop – 192.168.0.10
- PC – 192.168.0.11
Instructions
1. To install the DNS server, we need to install Bind 9.
sudo apt-get install bind9 2. Let’s configure Bind. We need to touch 5 files.
We will edit 3 files.
- /etc/bind/named.conf.local
- /etc/bind/named.conf.options
- /etc/resolv.conf
We will create 2 files.
- /etc/bind/zones/mydomain.com.db
- /etc/bind/zones/rev.0.168.192.in-addr.arpa
A. First step. Lets add our domain zone – mydomain.com.
sudo vi /etc/bind/named.conf.local # Our domain zone zone "mydomain.com" { type master; file "/etc/bind/zones/mydomain.com.db"; }; # For reverse DNS zone "0.168.192.in-addr.arpa" { type master; file "/etc/bind/zones/rev.0.168.192.in-addr.arpa"; }; Save file. Exit.
We just created a new domain. Please note: later we will create two files named mydomain.com.db and rev.0.168.192.in-addr.arpa files. Also, notice the reverse IP address sequence in the reverse DNS section.
B. Let’s add the DNS servers from your ISP. In my case, I’m using Comcast DNS servers. You can place the primary and secondary DNS servers here separated by semicolons.
sudo vi /etc/bind/named.conf.options forwarders { 68.87.76.178; }; Save file. Exit.
C. Now, let’s modify the resolv.conf file found in /etc and place the IP address of our DNS server which is set to 192.168.0.9.
$ sudo vi /etc/resolv.conf search mydomain.com. nameserver 192.168.0.9 D. Now, let’s define the zones.
sudo mkdir /etc/bind/zones sudo vi /etc/bind/zones/mydomain.com.db $TTL 3D @ IN SOA ns.mydomain.com. admin.mydomain.com. ( 2007062001 28800 3600 604800 38400 ); mydomain.com. IN NS ns.mydomain.com. ubuntudesktop IN A 192.168.0.10 www IN CNAME ubuntudesktop pc IN A 192.168.0.11 gw IN A 192.168.0.1 TXT "Network Gateway" The TTL or time to live is set for 3 days
The ns.mydomain.com nameserver is defined
ubuntudesktop, pc and gateway are entered as an A record
An alias of www is assigned to ubuntudesktop using CNAME
E. Let’s create a “rev.0.168.192.in-addr.arpa” file for reverse lookup.
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa $TTL 3D @ IN SOA ns.mydomain.com. admin.mydomain.com. ( 2007062001 28800 604800 604800 86400 ) IN NS ns.mydomain.com. 1 IN PTR gw.mydomain.com. 10 IN PTR ubuntudesktop.mydomain.com. 11 IN PTR pc.mydomain.com. 3. Let’s restart Bind to activate our latest changes.
sudo /etc/init.d/bind9 restart 4. Finally, let’s test our new domain and DNS entries.
Dig
$ dig mydomain.com Nslookup
nslookup gw 5. That’s it.
Monday, March 28, 2011
Subversion in Ubuntu
Initial Setup
sudo aptitude install subversion
The next steps is to create a new group that will be responsible for subversion tasks.
- From the Panel, navigate to System > Administration > Users and Groups
- If necessary, unlock the dialog, and then click “Manage Groups”
- Click “Add Group”. Create a group named “subversion”, and add yourself to it.
- Log out and back re-log in for the changes to take effect.
- n a terminal, create your new folder, using the commands:
cd /home
sudo mkdir svn
Adding the First Repository
cd /home/svn
sudo mkdir my-project
Finally, we use the “svnadmin” command to create some base files and configure the repository.
sudo svnadmin create /home/svn/my-project
Now, change the access permissions to give the subversion group the proper settings:
sudo chgrp -R subversion my-projectsudo chmod -R g+rws my-project
Configuring Your Repository
At this point, you should have a working repository. However, there are still a few options you might want to tweak. In particular, the access permissions. By default, a fresh repository will be readable by anyone and writable by authorized users. To change these settings, open /home/svn/my-project/conf/svnserve.conf in your favorite text editor– you can use the command:
gedit /home/svn/my-project/conf/svnserve.conf
The lines that control access restrictions look like:
# anon-access = read# auth-access = write
These two lines control anonymous access and authenticated access, respectively. To change from the default behavior for each value, remove the leading ‘#’ character, and set the right-side value to ‘read’, ‘write’, or ‘none’, for read-only, read-write, or no access, respectively. When you are finished, you can save the file and close it.
If you plan on using authenticated access to your repository, you will need to set up at least one username and password. To do so, open the/home/svn/my-project/conf/passwd file in a text editor:
gedit /home/svn/my-project/conf/passwd
To create a username, simply add a line to the bottom of the form:
username = password
There are a few examples already in the file, but commented out. You may add as many usernames as you need.
Access From the Host Computer
At this point you are ready to test out your new repository. Any configured repositories should be accessible from the host computer as-is. You can test it out by checking-out your first working copy:
svn checkout file:///home/svn/my-project ~/my-project-wc
Perhaps you would like to add a “trunk” directory, where you will develop your project:
cd ~/my-project-wcmkdir trunksvn add trunksvn commit -m "Add a trunk directory for development."
Depending on your configuration above, you may be asked for a user name and password. You should use the values you entered in the passwd file.
Monday, March 7, 2011
Installing PHPUnit to run phpunit.xml for Zend Server 5.3.1
1. Install PEAR by running go-pear.bat
if it starts to complain about: “… does not have a signature …” change the go-pear.bat to the following:
1 2 3 4 | @ECHO OFFset PHP_BIN=php.exe%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.pharpause |
2. Update pear:
pear channel-update pear.php.net
pear upgrade pear
3 Install PHPUnit via PEAR by running:
pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit
Friday, January 14, 2011
zend config file
Zend Boot strap
Sunday, October 24, 2010
Saturday, January 30, 2010
Zend Frame work in wamp -------
Tuesday, September 29, 2009
sh^M: bad interpreter: No such file or directory
Monday, September 7, 2009
How To Enable Adobe's Flash Player In Google Chrome (Ubuntu 9.04)
If the Flash plugin is already installed for Firefox, we have to find out where it is located:
sudo updatedb
sudo locate libflashplayer.so
If it is installed, output should be similar to this one...
falko@falko-desktop:~$ sudo locate libflashplayer.so
/opt/Adobe AIR/Versions/1.0/Resources/libflashplayer.so
/usr/lib/flashplugin-installer/libflashplayer.so
falko@falko-desktop:~$
... which means the Flash plugin is located in /usr/lib/flashplugin-installer/libflashplayer.so. If there's no output, this means that the Flash plugin isn't installed - you can then install it as follows:
sudo aptitude install flashplugin-installer
Now we create a plugins directory for Google Chrome...
sudo mkdir /opt/google/chrome/plugins
... and copy the Flash plugin to it:
sudo cp /usr/lib/flashplugin-installer/libflashplayer.so /opt/google/chrome/plugins
Finally we have to tell the Google Chrome launcher that it should look out for plugins. To do this, we right-click on Applications and select Edit Menus:

In the Menu Editor, go to Internet > Google Chrome and click on the Properties button:
Tuesday, August 25, 2009
Seting-Up a HTTP Proxy Server with Authentication and Filtering
Configure Squid by opening /etc/squid/squid.conf using your favorite text editor. In the configuration file, search for the following directives and modify (or add, if they don't exist) as it follows: http_port 3128 - The port Squid will listen for connections. If your system has two or more interfaces, you can specify which IP address to use. Eg: http_port 192.168.0.1:3128 http_access deny all - Search for it in the config file, uncomment it (remove the # in front), and replace deny with allow so it becomes http_access allow all. Restart the Squid proxy with: CODE $ sudo /etc/init.d/squid restartNow you should have a fully functional HTTP proxy. To try it out, open a browser, open its preferences dialog and go to proxy settings. Here, enter the IP address of the machine running Squid and the port set in squid.conf. Now load a webpage. SETTING UP SQUID AUTHENTICATION AND WEB FILTERING This section will allow you to set up a web site filter for kids. The first time an address is entered in the browser's address bar, an authentication dialog will pop-up, prompting for a username and password. We will set-up two usernames, one with full and another with restricted access. First, open the /etc/squid/squid.conf and add the following line in the auth_param section: auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd Now create the user accounts using htpasswd (use -c only for the first user): CODE $ sudo htpasswd -c /etc/squid/passwd dadCreate the ACLs by adding the following lines in the ACCESS CONTROLS (acl) sections in Squid.conf: CODE acl dadUser proxy_auth dadCreate the whitelist by opening a text editor, adding allowed domains like this: .google.com .kids-play.com .yahoo.com .msn.com and save it as /etc/squid/whitelist. Finally, search for http_access allow all in the Squid config file and modify it so it looks like this: http_access deny all This is how my Squid config sections look like: CODE # NETWORK OPTIONSUse deny all for squid with authentication and allow all for basic squid configuration. | |
create a shared and a static library with gcc
The code for the library
The header file
double mean(double, double);
Creating the static library
ar rcs libmean.a calc_mean.o
Creating the shared library
cc1: warning: -fPIC ignored for target (all code is position independent)
The programm using the library
#include#include "calc_mean.h" int main(int argc, char* argv[]) { double v1, v2, m; v1 = 5.2; v2 = 7.9; m = mean(v1, v2); printf("The mean of %3.2f and %3.2f is %3.2f\n", v1, v2, m); return 0; }
Linking against static library
Linking against shared library
Executing the dynamically linked programm
LD_LIBRARY_PATH=. ./dynamically_linked

