I am trying to talk to you friends about the things I like or are useful to me , please tell me if these are good or not.

Thursday, February 14, 2008

Configuring php with apache.

I tried sometime to install apache and configure php to work with it.I have some things to share.I have noted the steps I followed and found out the answers to few questions that came into my mind.See if this helps you.

Installation Instructions (Apache Shared Module Version) for PHP

Download the Packages:

1. First download the required packages to a directory.
Apache Download (http://httpd.apache.org/)
PHP Download (http://www.php.net/downloads.php)
MySql? Download (http://dev.mysql.com/downloads/)
2.

Extract the Apache and PHP Packages into that directory:

tar xfz apache_xxx.tar.gz
tar xfz php_xxx.tar.gz

Installing Apache with PHP:

Following are the steps to install Apache and PHP in the directory /usr/local/apache

1.

Go to Apache src directory

cd apache_xxx

2. ./configure --prefix=/usr/local/apache
3.

Go to PHP src directory

cd php-xxx

4.

./configure --with-mysql \

--with-xml \
--enable-track-vars \
--with-apache=../apache_xxx \

5. make
6. make install

If you decide to change your configure options after installation, you only need to repeat the last three steps. You only need to restart apache for the new module to take effect. A recompile of Apache is not needed.

Note that unless told otherwise, 'make install' will also install PEAR, various PHP tools such as phpize, install the PHP CLI, and more.

In Apache src directory

1.

./configure --prefix=/usr/local/apache \

--enable-module=rewrite \
--activate-module=src/modules/php4/libphp4.a

2. make
3. make install

This will install Apache in the /usr/local/apache directory.

Configuring Apache and PHP

1.

To configure PHP copy php.ini-dist which is in the PHP src directory to /usr/local/lib/php.ini

cp php.ini-dist /usr/local/lib/php.ini

2. Edit this file setting the options you wish, generally nothing needs to be edited. However, you can set various options such as a default MySQL username and password. If you prefer your php.ini in another location, use --with-config-file-path=/some/path while configuring PHP with the command ./configure .
3.

To configure Apache edit /usr/local/apache/conf/httpd.conf and set the your document directory and any other Apache settings you may want.

The path on the right hand side of the LoadModule? statement must point to the path of the PHP module on your system.

For PHP 4

LoadModule php4_module libexec/libphp4.so

For PHP 5

LoadModule php5_module libexec/libphp5.so

4.

And in the AddModule? section of httpd.conf, somewhere under the ClearModuleList?, add this:

For PHP 4

AddModule mod_php4.c

For PHP 5

AddModule mod_php5.c

5.

Tell Apache to parse certain extensions as PHP.

To enable Apache and PHP to work together the following line needs to be added

AddType application/x-httpd-php .php

Look for this line or something similar already in the httpd.conf file and replace it with the above. Make sure to remove the # comment mark.

6. After editing the config file you need to restart Apache. The command to restart Apache is:
/etc/rc.d/init.d/httpd restart


---------------
Investigate few issues?

1. Do we get RPM for both installations?
2. is /usr/local/apache directory is already been there before installing apache?
3. What is other path to apache config file except /usr/local/apache/conf/httpd.conf?

1. Do we get RPM for both installations?

RPM:

The RPM Package Manager (RPM) is a powerful command line driven package management system capable of installing, uninstalling, verifying, querying, and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like. There is also a related API ("Application Program Interface"), permitting advanced developers to bypass 'shelling out' to a command line, and to manage such transactions from within a native coding language.

RPM For Apache:

Almost identical to a binary, an RPM is further customized to play nicely with other RPMs and provide a consistent interface to installing, updating, and removing binaries.

To find out whether an Apache RPM is installed or not, at the shell prompt, type

rpm -qa | grep apache

To get Apache RPM

ftp://ftp.redhat.com/pub/redhat/current/i386/RedHat/RPMS

First became a root user by using command su and then type the following command

rpm -ivh apache-1.3.9-4.i386.rpm

RPM For Php:

We get RPM for PHP.

2. is /usr/local/apache directory is already been there before installing apache?

If we install Apache maually then we need to create the directories for Apache.

# mkdir /usr/local/apache
# chmod 755 /usr/local/apache

# cd /usr/local/apache
# mkdir conf logs
# chmod 755 conf logs

3. What is other path to apache config file except /usr/local/apache/conf/httpd.conf?

/usr/local/apache/etc/httpd.conf

To actually run Apache, you execute the apachectl script. Assuming you used the default directories when you built Apache, the full command line would be:

/usr/local/apache/sbin/apachectl start

You would use apachectl stop to stop the server, and apachectl restart to restart it. If you want Unix to automatically start Apache whenever the computer boots up, copy the apachectl file into the /etc/rc.d/init.d directory.

Monday, February 11, 2008

Linux based Development Machine

I  loaded  my Linux machine with the softwares needed for web development with PHP.
Following is the list of softwares that are replacement for their windows versions/based
softwares with similar capabilities.

After using them for a while I have given them points out of 10 for usability/features and
learning ease for a user new to Linux

Sr No.

Function

Windows

Linux(Fedora core 5)

features

Learning ease

comments

1 documentation MS office Open office 9 10
2 PHP Editor Zend Zend 10 10 paid
3 HTML editor Dreamweaver NVU 7 6
4 FTP Filezilla Filezilla 10 10
5 PDF Acrobat Evince 10 10
6 Network messanger pandion jabber 10 10
7 Email Client Outlook thunderbird 10 9
8 Browser IE Firefox 10 10
9 PHP/HTML editor Dreamviewer BlueFish 5 6


NuSphere (PHPed) Editor - On linux - My experience.



I have installed and used the LINUX version of nuSphere PHP editor on my machine .

1. Firstly I got the single installable file NuSphere-phped-3.3.3evl-Linux.sh.This is one good thing for this editor that it has a single installable file.

2. When I tried to run this file I got the following error


ERROR: The installer was unable to find shared libraries which are required
in order to run PhpED.

You should have these libraries installed:
/usr/lib/libstdc++-libc6.1-1.so.2
/usr/lib/libstdc++-libc6.2-2.so.3

To get these libraries installed you may need to install the package which
contains them. It may be named as libstdc++2.10-2.96, compat-libstdc++- 7.3-2.96
or have a different name, dependent on your Linux distribution. If you will have any problems, you may consult your Linux manual or get help from
http://support.nusphere.com forums.


To overcome this error

I installed compat-libstdc++-296-2.96-132.fc4.i386.rpm which I got at

ftp://rpmfind.net/linux/fedora/core/4/i386/os/Fedora/RPMS/compat- libstdc++-296-2.96-132.fc4.i386.rpm


Then I again tried to run installation file and it worked well.

automatically a shortcut is added to the program->development- >phpEd3.3.3 this is also one of the good thing about this editor(for zend it needs to be done manually).


the start up time for the editor is very less and it is very light weight when considered the number of features it provide.


5. I found a problem with coping and pasting text from or into the editor. I found that this bug is fixed in the latest version(according to http://support.nusphere.com/viewtopic.php?t=2704 )

6. Another problem I found is that the editor got hanged when I tried to save any file from my project. This problem is related to Fedora core 5 (according to http://support.nusphere.com/viewtopic.php?p=9036)
Today when I re-created the project workspace setup for the editor surprisingly I didn't face this problem.

7. Code help works great and is very fast.

8. A new thing I have seen is code explorer which shows all the variables, methods , classes etc. used in the script page. This is very useful feature.

9. All the features I would like for PHP editing are available and work swiftly in nuSphere. For editing HTML the basic features are available just design view is missing

10. There are several good advanced features like inbuilt FTP,Script profiler.

Overall this editor is very useful and is professional , point 5 and point 6 are the two important things to make it usable on Linux. Every thing else is just perfect.

User authentication for the helix streaming server

I was working on User authentication for the helix streaming server and after few iterations I got it working. I went through following process...
   Initially I installed a helix server on my desktop (I am currently using a windows XP desktop ) with an installer       v111_servinst_nodist_win32-i386-vc7.exe. 
   The server got setup quickly and I was able to test the streaming manually.I  got a  very useful manual at 
   http://www.realnetworks.com/support/docs.html 
   With the help of this manual I went through the authentication and I tried the flat file authentication of users but unfortunately I couldn't do it.       Then I went for the database way of authenticating users ,I found some useful information at    http://na3.salesforce.com/_ui/selfservice/pkb/PublicKnowledgeSolution/d?orgId=00D500000007Hzn&id=501500000007tP8 
   Using that I installed mysql-connector-odbc-3.51.21-win32.msi to get the odbc drivers available for creating DSN.     For Linux the drivers are available at 
   http://mysqlmirror.netandhost.in/Downloads/Connector-ODBC/ 

   I created a database named smil on yogesh's machine which is hosting mysql. I found that the default DB schema is available  for the      MS-SQL server with the default installation of Helix server.This can be found under 
  [serverpath]\Commerce\database\odbc\mssql\ppvdemo.sql 
  I updated the schema to suite mysql and created the table structure for authentication.there are two main tables which are needed for the user   authentication. 
  Note:I am attaching the mysql compatible sql file with this email. 
 1. Users Table  Gives the list of user names and passwords. 
 2.Permissions Table  Linked to the users table through the userid, this identifies the specific clips  or directories and the type of access for each. 
 detailed information about the field is available at 
 http://docs.real.com/docs/server11/wireline/HelixServerAdmin.pdf - > appendix C AUTHENTICATION DATA  STORAGE 

Then I created a system DNS named smil_users on my machine.

  Then  I went to the administration panel for the helix server. And followed the following steps 
 Step 1 :

 I opened the User Databases link in the left menu.    step 1 

I selected the Content_Basic from the left List. I changed the database type from Flat File to ODBC .Then I supplied the DSN information and applied the changes.

Step 2 :

 I opened the Authentication link in the left menu. 
  

Step 2

I selected the SecureContent from the list at left.Then I made sure that all the setting match as shown in the above snap.I applied the changes. I Clicked the Add a User to Realm link in the bottom. I added a user with user name user1 and password as clarion.Internally this connected to the database smil via DSN and added an entry into the user table for the user name and password

Step 3 :

 I opened the Authentication link in the left menu.

Step 3

I clicked the Commerce link in the left menu and selected SecureUserContent.I made sure that the settings match the above snap.I selected the default Secure directory for keeping the protected media files(that is /Secure as a protected path).I got to know that if I put the media files into this folder, player is forced to ask for authentication before letting the video play.

Step 3.1 Then I clicked the Grant User Permission link in the bottom as in the snap.I granted the permission for the /secured directory to the user user1.We can even specify a single resource file.

Step 4 : Then when tried to open the file from the real player I got a pop up like below Login

For wrong user name password the players ask again for the user name and password and for user name user1 and password clarion it goes ahead and gives the following message Message after login

Image:image005.jpg

This message appears because I have installed a free - version of the software and which doesn't allow to stream content without commercial license

Image:image006.jpg

Earlier I tried few other versions of the helix streaming server like rs1113-ga-win32.exe ,v111_servinst_plus_win32-i386-vc7.exe but after going through some manual tests and internet resources, I got to know that the free servers which allow streaming don't allow authentication popping up and the ones which allow authentication don't allow streaming.

Saturday, February 9, 2008

HTML to XML converter

Hi guys,

I have now learned how to convert HTML to XML.It can be done with one of my favorite tool
tide I mean html tidy. This is an open source tool and has a interface version for windows.

Now how to convert HTML t o XML ?

I will explain with command line interface (that will be good for all platforms)

tidy -asxhtml -numeric <> bar.xml
yes it is that simple and now you get the html converted into xml.If you see bunch of messages that tidy gives , you can just ignore them.

-asxhtml outputs XHTML documents instead of HTML.

it hardly takes few seconds.Isn't that great ???

here is the link to download HTML tidy

HTML Tidy

Friday, February 8, 2008

Text Generator

While I was talking with one of my friend , he told me about the text generator. He told me he got bored with the traditional dummy text kind of text. We used to call it Roman text earlier.It was a practice to put this dummy text or sample text for a mock site (dummy site design ).
Using that text was quite boring.He saw the text generator and was quite impressed with it.When I just had a look I also liked it a lot.Very simple and worth of using.
It generates some dummy text based on some rules. We can give specification to the text to be generated, paragraphs like number of parameters. One that I liked is this Text Generator. its very simple and useful. So for the designers who are bored putting dummy text for their HTML layouts or wire frames this is a good tool. Enjoy !!