Life in code, apps and OS's

Archive for April 2007

For months now I have been trying to setup a fast, reliable linux mail server. I think I have now cracked it. Basically my system layout is as follows;

I have been developing a new social community site called UrbanParty (www.urbanparty.net), The application is ran on my Ubuntu Linux server and uses SMTP to send out email notifications etc. In the past I have used Microsoft Windows server for mail as they are always much simpler to install and configure (well I think so anyway). However I could not really justify having another server for simply sending emails, Therefore I decided that im gunna try and crack the issue and thought that I would share the resolution with all of you 🙂

Ok here goes…

Firstly you will need Ubuntu linux installed, Im using Ubuntu Dapper Drake 6.06 (Server edition) however this how-to should also work for other versions of Ubuntu and should also work for Debian too.

Firstly we install Exim4 using ‘Apt-get’ so logon to your Ubuntu/Debian system as the ‘root’ user. Then issue this command:-

apt-get install exim4  exim4-config

Then Ubuntu should install the packages and then once installed issue this command:-

dpkg-reconfigure exim4-config

Now a graphical user interface will load to help you configure Exim quick, I am using my ISP’s SMTP server to ensure that all user’s recieve the email as mail services like Hotmail etc. are likely to block emails from unknown hosts. So now at the graphical prompts I do as follows:-

1. Choose: Mail sent by smarthost; Recieved by SMTP or Fetchmail
2. Enter Smathost relay:  smtp.yourisp.com

You will need to obviously need to change the host name of the smarthost to match your ISP’s mail server.

Now to test the mail server, I installed ‘mailutils’ so issue this command at the prompt to install mailutils

apt-get install mailutils

That will install some simple mail utilitys that will allow us to test sending an email etc. Once installed do as follows:-

mail youremail@yourdomain.inc (enter your email address here)
(press enter for Cc:, type in subject, press enter)
 (type in body of message, then enter)
.  
(type in single period, then enter, to end composing and email is queued)

Now you can check to see if the email message is still in the queue by typing the following command:

mailq

Your mail server should now be fully functional (for sending external messages) please not to recieve messages you may need further configuration of the mail server.

Hope this works for you.

If you liked this tutorial please show your support by visiting and registering on my site www.urbanparty.net it would be nice of you to upload and set a profile photo of you too. Thanks all, Hope to see you on the site soon 🙂

This was written by him (Harry Fuecks).. Not me, Im just posting this on my blog to spead the excelent tutorial and to keep it for future reference.

In case you missed it, yesterday Oracle announced a free (as in beer) version of their database—Oracle 10g Express Edition (XE)—basically a “lite” version—some industry analysis here. Significance of this move aside, more interesting is having a play. Managed to get the equivalent of a “Hello World” from PHP to Oracle up in under 1.5 hours today (ran into a specific glitch that required a re-install otherwise would have been less time). Here’s how…

Download is available at here. Be warned you’ve got a number of links to follow, an online license form to agree (check all the boxes) and finally a registration to fill in, before you get to the actual download. The download itself is about 150Mb and your system will need at least 250Mb RAM available to actual run the DB.

In my case installed it under Windows XP. There’s also a Linux version which I’ll be trying under Ubuntu later this week (had some hard disk issues recently which meant reinstall everything). Nothing available for OSX yet (the standard Oracle DB does support OSX though, so expect it’s a matter of time).

Once you’ve downloaded it, run the installer. It will ask you for a password for the “systen” user (think “root” user) which you should make sure you remember. The rest of the installation is just a matter of clicking “Next”. When finished it fires up a browser so you can login to your local instance of HTMLDb—something roughly equivalent to phpMyAdmin. In general, if you’ve ever tried installing the full Oracle database, this installation is breeze by comparison (not even a Java based installer—InstallShield I believe but could be wrong).

To login, you need the username “system” and the password you entered in the install process. You then need to following the instructions provided in the “Getting Started” guide (the installer adds a link to the guide on your start menu), in particular how to enable the “HR” user.

With that done, the next step is PHP. First things first you need to create a couple of environment variables (Control Panel > System > Advanced > Environment Variables );

  • ORACLE_SID = XE (…think of this as the name of your database)
  • ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server (…assuming a default installation path)

If you’re running Apache as a Windows service, the easiest thing to do now is reboot Windows.

Now edit your php.ini and uncomment extension=php_oci8.dll (I assume here you have extension_dir pointing at the right place)—note I’m running PHP 5.0.5 and the code below reflects that. Restart Apache and check out your phpinfo(). If you don’t get error messages about being unable to find php_oci8.dll, all is probably good. If you do get that error message, either the dll really can’t be found (check it exists in your extension_dir) or the above two environment variables are incorrectly set (or Apache is running as a service and you haven’t yet rebooted Windows).

Assuming all went well and you can see the OCI8 extension listed by phpinfo(), here’s something like a “Hello World”…

<?php 
$conn = oci_connect('hr','hr'); // This assumes
 you followed the Getting Start guide... 

$sql = "SELECT * FROM employees"; 

$stmt = oci_parse($conn, $sql); 

oci_execute($stmt); 

echo '<pre>'; 

while ( $row = oci_fetch_assoc($stmt) ) { 
  print_r($row); 
} 

echo '</pre>'; 
?>

Oracle has a bunch more info for PHP developers here.

From reading around and the little playing I’ve done, apart from the resource restrictions (one db per system, 1GB or mem usage max, 4GB database size max), it seems to have all the functionality as a normal Oracle DB (would be interested to hear more info on that if anyone has some).

Note that glitch I encounted, which may help non-US users, was I first attempted installing with Windows set to Swiss German as preferred language, which led to an ORA-27101 when I tried to login with SQL*Plus (and HTMLDb wouldn’t start). Switching to US English (Control Panel > Regional Settings > make everything “US English” on all tabs) solved this after a re-install.

Anyway—overall a pleasant installation experience. Oracle have definately “worked it out” in making getting started pain-free. Whether this will result in a big uptake amongst those that might otherwise choose an Open Source DB is hard to say. With the resource restrictions placed on the use of Oracle XE I doubt it’s really an option for shared hosts but it could be useful for software vendors who need to distribute a DB with their products. For developers it’s certainly a good place to start getting to know Oracle.

The original tutorial can be found here: http://www.sitepoint.com/blogs/2005/11/01/oracle-10g-xe-and-php/

Recently I’ve been bord and can’t think of any different peice of software to develop that I haven’t already developed. So as im interested in PHP and write alot of my web applications using this powerful, C++ style programming language, I have decided to develop a new style of USENET.

The system and idea behind its processes is simple and are as follows:-

  • Users can post messages anonymously
  • Messages can be replied to and are shown as threads
  • Users can search messages and replies
  • The system is completely search engine optermised, Therefore all documents are primarily found and searched from such search engines as Google and Yahoo! Search.

The database will be powered by Oracle 10g Express Edition.

Really this is just a simple project that I am going to undertake to educate myself with programing PHP and using Oracle 10g for the database backend.



  • How To Dyndns Ubuntu | Order Goods: […] DynDNS Client Setup on Ubuntu | Life in code, apps and OS’s – May 18, 2008  · 7 Responses to "DynDNS Client Setu
  • lizrandolph10886: Wonderful article! We are linking to this particularly great post on our website.nKeep up the great writing. Click
  • waseem Ahmad: Dear. i have a separate application server and a separate mysql database server. when i want to access the application server to login from the local