April 2007 Archives

Moving from ASP to PHP

| No Comments | No TrackBacks

I have a dream, mentioned in my Chinese Blog. I want to replce the current Windows 2003 server by a Linux server.

There are something to do before I move to Linux.

I am familiar with the Windows just like lots of other people who runs a Windows desktop.

Now for Server side, Linux, Bind, Apache, MySQL, postfix, and many server software are all running well.

The problem is I have to redesign my sites to PHP, MySQL. It is a big job.

It took me about 8 hours to convert G2Soft, main site of my Pentacle In-Out Board.

There are still some other sites I runing on this Windows server. I have to convert them one by one to a new site.

I have a Ubuntu 7.04 server here with following server.

Apache2 and PHP 5
The PHP info show as below:
pure-php5.gif

I still want to install Zend Optimizer.
So I go to Zend's official server, get the link of the latest version.

Now I record the steps how to install it on Ubuntu 7.04 server.
1) Login Ubuntu by Putty.

2) Enter the following command to download the source package for my i386 core.

wget http://downloads.zend.com/optimizer/3.2.8/ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz

3) Decompress the tar file

tar xvfz ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz

4) Install it.

cd ZendOptimizer-3.2.8-linux-glibc21-i386
./install.sh

During the installation, you need provide the path of the Zend installation,
/usr/local/Zend
PHP Configuration file location
/etc/php5/apache2
Apache Control Utility path
/usr/sbin

Done.

After installation, the PHP info changed to:
zend-php.gif

I have a related entries section on individual archive of this blog.
So any old posts have relation with current post will be listed under the bottom.
You like it, me too.

Suddenly, I think I can add this feature into my Feed.
Ok. let me do it and show you how to do it.

1) Under Template Module, create a new module named as "my-feed-fun":

<h3 class="trackbacks-header">Related Entries</h3>
<ul>
<MTRelatedEntries lastn="10">
<li><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></li>
</MTRelatedEntries>
</ul>

2) In Atom.xml template, find

<$MTEntryMore encode_xml="1"$>

Add the following after it.
<$MTInclude module="my-feed-fun" encode_xml="1"$>

Save and rebuild.

Done.

Yes, I learn to install WordPress MU on the 1and1 server.

I finished the installation very smoothly. Only one issue found by my friend George yesterday. He told me that the wp-signup.php does not work.
Actually, I have no problem on my computer with Firefox.

I just have an idea, it may be the IE. Ok, I click the ugly IE icon to load http://blogs.peaceever.com/. The wp-sign-up.php return the 404 error.

It is so strange.

I doing some search by Google "wp-signup.php ie 404".

I got the solution.
Open .htaccess in your WPMU folder.
Add the following line at the top:

AddType x-mapp-php5 .php

It works.

I don't know why it happened and what problem it come from. I just fix it.

Last week, I tried to install Virtualmin on my Ubuntu 7.04 server.

After installed it. I have a handy tool to add, modify or delete a website with ftp account, email account and MySQL database.

Let me show you the Virtualmin Feature Status
Available features Mail for domain, BIND DNS domain, Apache website, Webalizer reporting, Log file rotation, MySQL database, Webmin login
Disabled features SSL website, PostgreSQL database, ProFTPd server
Disk quotas Not active on home directories filesystem.
Mail server Postfix

I just installed the Virtualmin as a Webmin module, not the Virtualmin Pro. I heard Pro has more advanced features.

The detailed version information I used is :Version 3.39.gpl, master admin mode .

I just upgrade my Ubuntu Server 6.10 to Ubuntu server 7.04.

Let me show you which server software I have now with version.

OS: Ubuntu 6.10 > 7.04
Control Panel: Webmin 1.320 > 1.340
DNS server: Bind 9.32 > 9.34
Web server: Apache 2.0.55 > 2.2.3
FTP server: ProFTPD Server 1.30
Database server: MySQL version 5.0.24 > 5.0.38
SSH server: OpenSSH_4.3
SMTP server: Postfix version 2.3.3 > 2.3.8
POP/IMAP server: Dovecot IMAP/POP3 Server 1.0
Webalizer: Webalizer version 2.01-10

I always thinking about to have a home-brewed VOIP server. Such as this one, Build a Skype Server for Your Home Phone System, it is a skype server, not exactly what I want, but still good.

Through this Skype server, you can have a small phone system in your home.

The full function of home VOIP server is based on Open-source software and free of charge.
Asterisk
With two or three VOIP card, you will have a system, you can call out, or receive incoming call.
You can also have a conference call in your home.

Do you need it?

Running on Linux.

The default LAMP installation on Ubuntu 6.10 server doesn't include mod_rewrite module.

This module is required by WordPress MU.

I tried to install a WordPress MU on my Ubuntu server with LAMP.

To install mod_rewrite, run command as below:

sudo a2enmod rewrite

There is still another issue for WordPress MU installation. It is need a smtp service to send password to registered user.

If you do not have a postfix server on your Ubuntu, you'd better install this server first. Otherwise you can not active your account and your WordPress MU.

I did it. The ispconfig is installed on my Ubuntu 6.10 successfully yesterday.

I met some problems when I tried in last few days.

0) Download ISPConfig 2.2.11
Log in to shell as root.
Unpack the ISPConfig-archive

tar xvfz ISPConfig-2.2.11.tar.gz

and change to the directory install_ispconfig:
cd install_ispconfig

Start install
./setup


1) When I met this error:
"configure: error: Cannot find MySQL header files under /usr."

Remember to install mysql-devel.
To install ISPConfig, the MySQL Devel packages are necessary. After you installed the mysql-devel package from your linux distro, you can run the ISPConfig setup again.

2) During installation, if saw:
./configure:Error: APACI failed
ERROR: Could not configure Apache

Use following commands to fix it.

rm /bin/sh (or if you want to be safe: mv /bin/sh /bin/sh.dash)
ln -s /bin/bash /bin/sh

It is because Ubuntu developers have replaced Bash with Dash, so the regular /bin/sh that is used to be linked to /bin/bash is now pointing to /bin/dash.

I installed a testing Ubuntu Server on April 3.

Some software or server application are installed on in during last 7 days.

Now I have a worked server which can be put under production environment.
Let's list the detail information of them.

OS: Ubuntu 6.10
Control Panel: Webmin 1.320
DNS server: Bind 9.32
Web server: Apache 2.0.55
FTP server: ProFTPD Server 1.30
Database server: MySQL version 5.0.24
SSH server: OpenSSH_4.3
SMTP server: Postfix version 2.3.3
POP/IMAP server: Dovecot IMAP/POP3 Server 1.0
Webalizer: Webalizer version 2.01-10

Others:
PHP: PHP 5
Perl: Perl version 5.8.8

I also install other programs on top of above platform:
Webmail interface: SquirrelMail version 1.4.8
Log analytics: Advanced Web Statistics 6.5 (build 1.857)
phpMyAdmin: phpMyAdmin - 2.8.2-Debian-0.2

Two applications:
MovableType 3.44
WordPress 2.1.2

To install Wordpress blog system on Ubuntu 6.10 server with LAMP is super easy.

Let's do the following steps to install it.

1) Download WordPress and unzip it.

2) Create a database on my MySQL server. I use Webmin to create it.

3) Rename the wp-config-sample.php file to wp-config.php.

4) Open wp-config.php and fill the MySQL information into it.

// ** MySQL settings ** //
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpresspassword');
define('DB_HOST', 'localhost');

5) Upload all filles to WWW folder.
Mine is /var/www/

6) Enter http://example.com/wp-admin/install.php to start installation script.

7) The final WordPress blog is here
http://ubuntu.g2soft.net/


I spend about 5 minutes to complete installation.

I have posted Fight against Spam, Spammer and Bots on PHPBB forum system.

I have Humanizer mod for PHPBB, and Hide User's WebSite Button 1.0.3 on my forum to protect against spam.

Now I feel it is not enough. I clean the spam every day.

I found this one SpamWords.
It can prevent the spam post with the "spam words" I setup in the system in advance.
It is cool that when a spammer want to post some spam, he will receive the error message and he can not successfully post it.

If you want this plugin, you can Download file here.

It will add some tables in your PHPBB database, and modify some files and install some new files.

The difficult fact is medium.
It took me about 15 minutes to install it. Please backup all files and database before installation.

The latest version, WordPress Version 2.1.3, was released to the public on April 3, 2007.
Now I upgrade one blog from WordPress 2.1.2 to 2.1.3.

I recorded upgrade steps here as notes.

1) Backup your database.

choose-database.gif
Click "phpMyAdmin" button of the specific database.

click-database.gif
On the left panel, click the name of database.

click-export.gif
Now, the right frame of the window, show me the tables of this database, click Export.

export-database.gif
Click "Select all" to select all tables, and check the check box as the screen above. Select "Save as file", then click "go" button.

Save the database exporting file.

2) Backup ALL your WordPress files in your WordPress directory.
I used the Dreamweaver to download all files under WordPress installation folder.

3) Deactivate ALL your Plugins.
I sign in as administrator, and deactivate all plugins.

4) Download and extract the WordPress package from http://wordpress.org/download/.
Download the 2.1.3 package, I downloaded zip file and uncompressed it.

5) Upload all filles to the Server

6) Run upgrade.
http://www.mydomain.com/wp-admin/upgrade.php
Because of I upgraded from 2.1.2, only one step to finish this upgrade.

7) Activate the Plugins I used before.

Finish.

How to find perl module and install it under Ubuntu?
1) You have to find the package of this module.
For example, I want to install GEO::IPfree module for enable IPfree plugin in Awstats.

sudo apt-cache search perl geo::ipfree

2) It will return the package name as below:

libgeo-ipfree-perl

3) Now I can install this module by following command:

sudo apt-get install libgeo-ipfree-perl

Done.

I have Awstats on Windows box. I also have some posts about how to install it and config it.

Now I am a Ubuntu fans. I will show you how to install Awstats on Ubuntu server 6.10.

1) Under command line mode, or putty.

2) apt-get install awstats
This command is install Awstats. Currently it is v6.5.

3) Edit configuration file, it is located /etc/awstats/
cp awstats.conf awstats.yourhostname.conf
Change something to reflect your own settings.

LogFile="/var/log/apache2/access.log"
LogFormat=1
DNSLookup=1
DirData="/var/cache/awstats/"
DirCgi="/cgi-bin"
DirIcons="/icon"
SiteDomain="yourhostname"
AllowToUpdateStatsFromBrowser=1
AllowFullYearView=3

4) Make a directory called /var/cache and chmod it 777 so it can be used from the web server
mkdir /var/cache
chmod 777 /var/cache

5) Copy icons to web directory:
cp -r /usr/share/awstats/icon /var/www/icon

Linux Command

| No Comments | No TrackBacks

Some Linux commands are very similar to Windows one.
I list them here for reference.
cd
The cd command will allow you to change directories
ls
The ls command will show you the files in your current directory.
cp
Make a copy of a file for you.
mkdir
The mkdir command will allow you to create directories.
rmdir
Remove the directory
df
The df command displays filesystem disk space usage for all mounted partitions.
du
The du command displays the disk usage for a directory.
rm
rm -rf \abc
Delete folder \abc, including all sub-folders and files under it.
mv
The mv command will move a file to a different location or will rename a file.

some other used ofter commands
tar xvfz 12345.tar
apt-get install
apt-get remove
apt-get update
apt-get upgrade
sudo nano .\abcd.cf
Edit .\abcd.cf in a nano text editor.

I was downloading some mp3 by emule yesterday night.
When I want to go to bed, there are still 40 minutes. How can I do? Turn off it or leave it on whole night?

OK. I use a command to schedule to shutdown my computer in 1 hour.

Click start > Run,
Enter cmd,
Enter

shutdown -f -s -t 3600

It means after 3600 seconds, the computer will be forced to shutdown.
-s Shuts down the local computer
-f Forces running applications to close.
-t xx : Sets the timer for system shutdown in xx seconds. The default is 20 seconds.

If you want more detail of this command, click here.


Last week, I installed Ubuntu 6.10 server version Linux on an old computer.
You can see some information below from phpSysInfo.
ubuntu-phpsysinfo.gif

Let me record my installation history.

1) Download Ubuntu 6.10 server image file, and burn it on CD.

2) Boot the computer from this boot-able CD, while promoted, I choose LAMP, and use all 40GB hard disk for Ubuntu.

3) After Installed new system and boot into Ubuntu system. There is no GUI in default.

4) Change Source list.
Modify
/etc/apt/sources.list
Add following sources in the end of the file

deb http://ubuntu.cn99.com/ubuntu/ edgy main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ edgy-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ edgy-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ edgy-proposed main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ edgy-backports main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ edgy main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ edgy-security main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ edgy-updates main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ edgy-proposed main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ edgy-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ edgy main restricted universe multiverse

5) Update system

sudo apt-get update
sudo apt-get upgrade

6) Install Webmin 1.330
Go to Webmin official site to download.
Decompress it and run,

sudo apt-get install build-essential
cd (webmin directory)
sudo ./setup.sh /usr/local/webmin

When installation completed, enter http://127.0.0.1:10000, or https://127.0.0.1:10000 to web interface.

Now I have a Linux box with features as below:
OS: Ubuntu Linux
Database: MySQL 5
Webserver: Apache 2
Language: PHP 5

I installed proftpD, Webalizer later.

I learn something about how to setup a secure home network. I also want share this one to the others.

1) There are some question you have to ask yourself first. It will help you to identify your network needs..
a. How many wired Ethernet ports, if any, will you need?

b.Where will these Ethernet ports need to be located? (In other words, where will the PCs and other equipment that will be plugged into these Ethernet ports be located?)

c.Where will the router and high-speed modems be located?

2) Then determine where to put your modem and router.

3) Gather all tools and supplies
Cat 5 Ethernet Cable
Cat 5 cable connectors
Crimper
Cable/DSL modem, It is provided by ISP normally.
Wired/Wi-Fi router. I do prefer wired router. It is safe and less security setting problem. If you still like WI-Fi router, I recommend you to use 802.11g router instead of 802.11b.
Ethernet hub

4) Connect all the cables together
I hope you add some tag on both ends of each cable. It will help you to identify them.

5) Test Your Network Connection
You can ping all other computers from one.

6) Set Up Your Router

7) Securing Your Network
This is the most important part I think.
a]. Change the SSID of your router. Use a name that's innocuous and doesn't refer to your business.
b]. Disable your wireless router's "SSID Broadcast setting." This will prevent random snoopers from seeing or detecting your Wi-Fi network through ordinary means.
c]. Set up either 128-bit WEP encryption of Windows' WPA encryption. This is a fairly easy process that varies depending on your router's software.
d]. Enable the firewall on your wireless router (if you have one).

About this Archive

This page is an archive of entries from April 2007 listed from newest to oldest.

March 2007 is the previous archive.

May 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.21-en

Online Tools