Archive

Posts Tagged ‘mac’

Leopard + Apache 2 + NTLM + PHP + Integrated Windows Authentication

April 15th, 2009

Everyday we face lot of challenges and today it was to make our CMS work with NTLM(NT LAN Manager Windows authentication protocol) Single Sign-On. I hope you didn’t get any shit what I meant above and so was I when I got the requirement.

In windows network we can connect all computers to a domain and it will have a domain controller. Once your computer is connected to the domain you will be asked enter your domain user name and password when ever you log on to system. After you log in it will use the same credentials to authenticated all the domain related objects like network, files, exchange and so on. In most of the corporations this how they manage the systems with group policies applied to each users.

In Internet explorer there is a feature to use the same credentials to authenticate intranet websites. This is Single Sign-ON. There is very nice article which can help you if you want to set it up.
internet-explorer-authentication-setting

So my application should be able to detect whether the browser is authenticated already or raise if needed and it will validate the credential with domain controller. There is no direct methods available in PHP to achieve this. So to achieve this I had to rely on NTLM auth module for Apache. It was pretty outdated and Raimonds Simanovskis has updated the source tree and had released a patched version here. I was able to compile it without any issues. Download and extract the files and run this.


#sudo /usr/sbin/apxs -i -a -c mod_ntlm.c
...
Libraries have been installed in:
/usr/libexec/apache2
...
chmod 755 /usr/libexec/apache2/mod_ntlm.so
[activating module `ntlm' in /etc/apache2/httpd.conf]

Most important part adding ntlm module to Apache is done. The next step in make some some modification in htaccess file. Configuration setting can be read in detail from here.

AuthName NTAuth
AuthType NTLM
NTLMAuth on
NTLMAuthoritative on
NTLMDomain DOMAIN-NAME
NTLMServer SERVER1
NTLMBackup SERVER1
NTLMLockfile /tmp/_my.lck
require valid-user

Make sure that the computer where you have installed apache should be able to connect to domain controller. Always use full domain names and not IP as it will give errors while connecting [reference] . You are fully set now and if everything is correct you will get these variables in PHP with current logged in details.


$_SERVER['AUTH_TYPE'] => NTLM
$_SERVER['REMOTE_USER'] => xxxxx
$_SERVER['REMOTE_PORT'] => xxxx

I have tested this with Internet explorer and it will work without asking password. For other browsers like Firefox, Chrome, Safari it will prompt for authentication. Thats all folks ;-)

Programming , ,

Compile and install PHP 5.2.8 on Mac OS X 10.5.6 (Leopard)

February 24th, 2009

Due to some limitation I faced with Xampp I finally decided to compile PHP5 native on my mac. Entropy was a best option for mac till Leopard was released. Since Leopard came with php built in entropy was no more available. After Googling for a long time and breaking my head with errors for 7 long hours I finally got it working perfectly like how I wanted it. These are some of the steps I followed to compile the same. I tested the same steps in 2 macs and it was working fine. I cannot guarantee that these steps would work for everyone.

Step 1

You need to have Xcode installed on your mac. In my case I had Xcode 3.1.2 installed. You can install from your Leopard DVD or you can install iPhone SDK.

Step 2

Download and install the latest Mysql database server.

Step 3

Install Fink. You can download the version 0.9.0 which I used for compiling from here. Once you have installed open terminal and issue the following commands.

# sudo fink selfupdate
# sudo fink update-all

The above two commands will update the needed files for fink library to work properly. Once this is done you can install needed libraries for php by issuing the following command

# sudo fink install libjpeg libtiff libpng3 libxml t1lib5 libmcrypt libmhash mysql15-dev curl wget

Step 4

Install FrontBase if it is needed for you. It is installer file you can download it from here. If you don’t want to use this database system you can remove the option ‘–with-fbsql’ from the php configure command.

Step 5

Install Freetds if you want use MS-SQL in PHP5.

# sudo su
# curl -O http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
# tar xvzf freetds-stable.tgz
# cd freetds-0.82/
# ./configure && make && sudo make install

Incase if you feel this is not needed for your installation you can remove the option ‘–with-mssql’ and ‘–enable-dbase’ from the php configure command.

Step 6

Install Imap Client libraries files. You need this lib to be installed if you wish to compile imap. If you don’t want you can remove the option ‘–with-imap’ and ‘–with-imap-ssl’. Further reading on this topic visit here.

# sudo su
# curl -O ftp://ftp.cac.washington.edu/imap/c-client.tar.Z
# tar xvzf c-client.tar.Z
# cd imap-2007e/
# make oxp
# cd c-client/
# cp *.h /usr/local/include
# cp *.c /usr/local/lib
# cp c-client.a /usr/local/lib/libc-client.a

Step 7

Install gettext. This is a must for lot of open source projects and for localization.

# sudo su
# curl -O ftp://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz
# tar xvzf gettext-0.17.tar.gz
# cd gettext-0.17
# cd gettext-tools/
# ./configure
# make
# make install

Step 8

Install freetype. You need if you wish to load free type fonts in GD.

#sudo su
# wget http://mirrors.zerg.biz/nongnu/freetype/freetype-2.3.8.tar.gz
# tar xvzf freetype-2.3.8.tar.gz
# cd freetype-2.3.8
# ./configure
# make
# make install

Step 9

I think we are pretty there and now it is time to compile the big boss the PHP itself.

# sudo su
# wget http://www.php.net/get/php-5.2.8.tar.gz/from/in.php.net/mirror
# tar xvzf php-5.2.8.tar.gz
# cd php-5.2.8
# ./configure --prefix=/usr/local/php5.2.8 --with-apxs2 --with-config-file-scan-dir=/usr/local/php5.2.8/php.d --with-openssl=/usr --with-zlib=/usr --with-gd --enable-gd-native-ttf --with-jpeg-dir=/sw --with-jpeg-dir=/sw --with-png-dir=/sw --with-zlib-dir=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-calendar --enable-bcmath --with-bz2=/usr --with-curl --with-kerberos=/usr --with-libxml-dir=/sw --with-xsl --with-t1lib=/sw --with-mcrypt=/sw --with-mhash=/sw --with-mysql=/sw --with-mysqli --with-pdo-mysql=/sw --enable-zip --with-imap --with-imap-ssl --with-gettext --with-curl=/sw --with-pear --with-regex --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv=shared,/opt/local --enable-dbase --enable-sqlite-utf8 --with-fbsql
# make
# make install

If you have completed till the above step without any error means that you have successfully installed PHP5. If you restart your apache server from system settings the server might not work for you. Since it might conflict a bit due to various architecture problems in apache and php build. To over come this issue you need to re-compile apache. You can do it by issuing the following commands. Further reading on this issue.

Step 10

Recompile Apache 2.

# sudo su
# wget http://apache.siamwebhosting.com/httpd/httpd-2.2.11.tar.gz
# tar xvzf httpd-2.2.11.tar.gz
# cd httpd-2.2.11/
# ./configure --enable-layout=Darwin --enable-mods-shared=all
# make
# make install

screenshot1screenshot2

Once everything is done you should be able to run PHP. Have fun compiling your own native PHP on your mac ;-) .!!!

Linux ,

boxee: social media center for mac

January 29th, 2009

Today I read a tweet from Martin regarding media server. It is boxee. I registered in their website, downloaded the application and installed it. It is really amazing and the interface was kick ass. It will be great for those who wanted to buy an Apple TV ;-)


quick intro to boxee from boxee on Vimeo.

I was not able to watch ABC videos from India :-(

Personal ,

MailTags – powerful email organization plugin for Mail application

October 10th, 2008

MailTags is one of the best plugin I ever used for my Mail application. I found this plugin when I had to organize my inbox with follow ups and todos. The plugin intergration with the application is very good.

Integrated Interface – Use MailTags’ convenient side panel to add tags keywords, project, priority, notes to your messages. Use contextual menus to tag several messages at the same time. All of MailTags interfaces feel built in, not added on.

IMAP Support – Save your tags to your IMAP servers so you can access them from multiple computers.

List Display – Display your tags in extra columns in the message list view. See due dates as they approach.

Works with Mail’s Smart Mailboxes – Build smart mailboxes that search your messages for keywords, projects and even due dates.

Works with Mail’s Rules – Set tags automatically as you receive Mail by using MailTags actions when creating a Mail rule. Use with Mail Act-On to create keystroke rules to tag messages.

Works with Mail’s Search – Search for your tags by using Mail’s search field, narrow the search to keywords, projects or notes.  Use simple and/or logic to find tags.

Tag Mail 3.0 Notes – Create a note for yourself with Mail 3.0 notes feature and tag it with projects, keywords, tickle dates and priorities for future reference. Find those notes in smart mailboxes.

RSS support – Tag news items for future reference. Ideal for workflow management where a RSS subscription notifies you of forum posts, support requests or tasks.

iCal Support – Create To Dos and Events in iCal directly from Mail and maintain the link between the original message and the items in iCal.

Send Tags in Messages – Not only can you tag your outgoing mail for your purpose, you can send tags with the messages to create an informal workflow with your recipients.

Incoming Reply Tagging – Automatically copy tags from earlier messages when receiving replies.  Maintain tags in a discussion even if the other correspondent doesn’t have MailTags.

Add functionality with Extras – MailTags new extensible architecture means that you will be able to add functionality to MailTags by adding an Extra.  Planned extras include components that work with Google Calendar, TaDa list and other web based task/event management system. We plan to publish an Extras SDK so others can extend MailTags.

Applescript Compatible – Construct Applescript work flows that access your MailTags data to use them in other applications.

All for just 30$. Real worth for money :-)

Software , ,

Gulfnews vs EMUG users about PC and Mac

June 14th, 2008

There is an interesting debate going between Gulf news technical writer Scott Schuey and users from Emirates Mac User Group (EMUG) about the article published by Scott on 7th june 2008 about Investing in a suitable computer system.

The users of EMUG started to discuss about that article “Gulf News answers the Question Should I buy an Apple Macintosh instead of a personal?

Scott gave reply with another article on 14th June 2008 as “Live with it: Mac is not the greatest“.

Here goes the reply for the article by the EMUG users “Gulf News pissed with EmiratesMac

The debate is going red hot, I am waiting for the next reply from Scott Schuey !!!

Dubai ,

Fedora 9 Sulphur on VMware Fusion

May 16th, 2008

I have been always a very big fan on Fedora Linux distribution. In recent times I have moved very much into Ubuntu. Three days back Fedora team had released the new version 9 named sulphur. I really wanted to test it how well it is working with VMware. So the hunt began.

Downloaded the i686 DVD version and started the installation. In VMware OS list there was no fedora so I had to select red hat Linux as option. The installation went very smooth and no issues or error. I felt the installater was little heavy when compared to Ubuntu installation.

Fedora booted up well and detected most of the hardware of VMware. But It was not as smooth as Ubuntu was on VMware.

I heard there is lot of improvement and enhancements. But Ubuntu is very far ahead when it comes to Desktop Linux. I prefer sticking with Ubuntu than Fedora sulphur :D

Linux , ,