Wordpress as CMS

WordPress is highly versatile blogging platform, it is so versatile that you can many attempt to push it to the next level, and use it as a more conventional content management system- Ever since the very early releases of WordPress, users have been eager to customize the software to suit their own needs.

Today’s the more prevalent needs in context is required, the  Content Management System need  more flexibility and power, WordPress has ability of that to customized into a full fledged CMS, and many people are already doing just that!  Check here few important steps, how you can take Wordpress to its next level and what things to consider when using WordPress as a CMS;

There are especially 3 things you need to consider before committing to WordPress as a CMS, and starting to plan it,  as far as I can tell. [ Read full article]

Comments (2)

Install Ruby

Make sure before installing Ruby, zlib is installed in PHP. You can do this by running a simple script with this code.

<?php phpinfo(); ?>

Now you are ready for installation.

cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz
tar xvzf ruby-1.8.2.tar.gz
cd ruby-1.8.2
./configure
make
make install
ruby rubytest.rb

If the installaiton is successful, then you will get a message “test succeeded”.

Install Ruby Gems

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar xvzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb all

This step involves execution of `ruby setup.rb` with arguments `config / setup / install` all together

gem query –local
OR
gem q -L

Listing all installed gems
Install Rails

gem install rails   OR # (Enter Y for all dependencies)
gem install rails –include-dependencies

Install FastCGI

wget http://fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xvzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install

Install mod_fastcgi

wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
tar -xvzf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
/path/to/apxs -o mod_fastcgi.so -c *.c
/path/to/apxs -i -a -n fastcgi mod_fastcgi.so

In Apache’s httpd.conf, add this line.

Include /path/to/httpd/conf/fastcgi.conf

Now, add this text to fastcgi.conf

cat > /path/to/httpd/conf/fastcgi.conf
User apache
Group apache
<IfModule mod_fastcgi.c>
FastCgiConfig -idle-timeout 900
AddHandler fastcgi-script .fcgi .fpl .rb
FastCgiIpcDir /tmp/fastcgi_ipc/
FastCgiSuexec /usr/sbin/suexec  # To make FastCGI run as suexec. Use path to suexec
</IfModule>

Ctrl + D

mkdir /tmp/fastcgi_ipc/
chown -R apache.apache /tmp/fastcgi_ipc
chmod 700 /tmp/fastcgi_ipc/
service httpd restart

NOTE : In some systems, the ownership of fastcgi_ipc is done by Apache itself, but its safe to include these steps in your routine.

Related files: /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/dispatches/dispatch.fcgi # OR ~USER/<app_name>/public/dispatch.fcgi # Log file declaration & all
Install gem bindings

To install gem bindings for Fastcgi and MySQL

gem install fcgi
gem install mysql

Testing
1. Install Test Application

cd ~USER
rails testapp  # Create a test application named ‘testapp’
cd testapp/
./script/generate controller test
cd ~USER/httpdocs
ln -s ~USER/testapp/public rails # In order to access the test application ‘~USER/testapp/public’ from the browser

In order to allow symlinks, enter the following in to ~USER/httpdocs/.htaccess

Options Indexes +FollowSymLinks

Now you have to set the correct ownership and permissions for the test application. here is the cample; example:

cd ~USER
chown -R USER.psacln testapp
chmod -R 755 testapp
chown -R USER.psacln httpdocs/rails
chmod -R 755 httpdocs/rails

Create Test Pages

cd ~USER
cd ~USER/testapp/app/controllers

Create a file called test_controller.rb and put in the following code:

cat > test_controller.rb
class TestController < ApplicationController
def hi
render :text => ‘Hi world’
end
def hello
end
def index
render :text => ‘Hi! This is the Index.’
end
end
Ctrl + D

Now create the test page.

cat > ~USER/testapp/app/views/test/hello.rhtml # The test page
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello from Rails!</h1>
<p>The current time is <%= Time.now %></p>
</body>
</html>

Ctrl + D

Now just access the URL: http://yourdomain/rails/test/hi

NOTE:- Make sure change ownership of the test pages you created.

Now, You have installed Ruby On Rails

Leave a Comment

How to create Remote login page for cPanel

If your website has HTML codes you can create a remote cPanel login page. Consider your website url is www.yourdomain.com, your cPanel login url will be http://www.yourdomain.com:2082 for non-SSL or https://www.yourdomain:2083 for SSL login.
You need to put the following HTML from in your website HTML codes.

<form action=’http://www.yourdomain.com:2082/login/’ method=’post’>
<table border=’1′ width=’250′ cellpadding=’2′ cellspacing=’0′>
<tr>
<td align=’right’>Username:</td>
<td><input type=’text’ name=’user’></td>
</tr>
<tr>
<td align=’right’>Password:</td>
<td><input type=’password’ name=’pass’></td>
</tr>
<tr>
<td colspan=’2′ align=’center’><input type=’reset’ name=’r1′ value=’Reset’><input type=’submit’ name=’s1′ value=’Login’></td>
</tr>
</table>
</form>

In the code, you should replace “www.yourdomain.com” with your website domain name.
If you want to use SSL login, you should replace “http” with “https” and “2082″ with “2083″.
Replace “Username:” and “Password:” with your own phrase if you like to translate it or such.
Replace “Login” and “Reset” with your own phrase if you like to translate it or such.

Nowyou can put  put this code in your website every where you need in the body section.

Leave a Comment

How to Create Remote login page for DirectAdmin

To create a remote DirectAdmin login page, you will have to put some HTML codes in your website.
Consider your website url is www.yourdomain.com, your DirectAdmin login url will be http://www.yourdomain.com:2222 for non-SSL or https://www.yourdomain.com:2222 for SSL login.
You need to put the following HTML from in your website HTML codes.

<form action=’http://www.yourdomain.com:2222/CMD_LOGIN/’ method=’post’>
<table border=’1′ width=’250′ cellpadding=’2′ cellspacing=’0′>
<tr>
<td align=’right’>Username:</td>
<td><input type=’text’ name=’username’></td>
</tr>
<tr>
<td align=’right’>Password:</td>
<td><input type=’password’ name=’password’></td>
</tr>
<tr>
<td colspan=’2′ align=’center’><input type=’reset’ name=’r1′ value=’Reset’><input type=’submit’ name=’s1′ value=’Login’></td>
</tr>
</table>
</form>

In the code, you should replace “www.yourdomain.com” with your website domain name.
If you want to use SSL login, you should replace “http” with “https”.
Replace “Username:” and “Password:” with your own phrase if you like to translate it or such.
Replace “Login” and “Reset” with your own phrase if you like to translate it or such.

Now just put this code in your website where ever you need.

Leave a Comment

Creating Your Own Server Stat Script in PHP

Before you create your own server stat script in PHP, it is must to check your ports are responding.  You should aware when one of your services are down, such as HTTP, MySQL, POP/SMTP, etc.  Also, other information you should know the current server loads, and users which will be the chief  indicator of a runaway script, or process.

So let’s start.

Make sure your php script ALWAYS must start with <?php  this tells your server that it is in fact a php script

<?php

//You can replace the domain with an IP if you wish

$site = “mysite.com”;  //this is the site you wish to check

// Let’s check our common ports 80, 21, and 110
$http = fsockopen($site, 80);
$ftp = fsockopen($site, 21);
$pop3 = fsockopen($site, 110);

if ($http) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>HTTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>HTTP</b>: Not Working</font></font><br>”;
}

if ($ftp) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>FTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>FTP</b>: Not Working</font></font><br>”;
}

if ($pop3) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>POP3/SMTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>POP3/SMTP</b>: Not Working</font></font><br>”;
}
echo(”$status”);

echo(”<hr>”);

// Users and load information
$reguptime = trim(exec(”uptime”));
if ($reguptime) {
if (preg_match(”/, *(\d) (users?), .*: (.*), (.*), (.*)/”, $reguptime, $uptime)) {
$users[0] = $uptime[1];
$users[1] = $uptime[2];
$loadnow = $uptime[3];
$load15 = $uptime[4];
$load30 = $uptime[5];
}
} else {
$users[0] = “Unavailable”;
$users[1] = “–”;
$loadnow = “Unavailable”;
$load15 = “–”;
$load30 = “–”;
}

echo(”<b>Current Users:</b> $users[0]<br>
<b>Current Load:</b> $loadnow<br><b>Load 15 mins ago:</b> $load15<br><b>Load 15 mins ago:</b> $load30<br><hr>”);

// Operating system
$fp = @fopen(”/proc/version”, “r”);
if ($fp) {
$temp = fgets($fp);
fclose($fp);

if (preg_match(”/version (.*?) /”, $temp, $osarray)) {
$kernel = $osarray[1];
preg_match(”/[0-9]{5,} (\((.* *)\)\))/”, $temp, $osarray);
$flavour = $osarray[2];
$operatingsystem = $flavour.” (”.PHP_OS.” “.$kernel.”)”;
if (preg_match(”/SMP/”, $buf)) {
$operatingsystem .= ” (SMP)”;
}
} else {
$result = “(N/A)”;
}
} else {
$result = “(N/A)”;
}

echo(”<b>Operating System:</b><br>$operatingsystem”);
?>

The above code when uploaded to your server, it will display the status of your services, your user and load averages.

Now you can work with this, and make it look however you want, add new ports, etc.

Remember, this is just a very basic stat script.

Key Issues
One of the key issues you should aware that your host will need to allow the exec() funtion, in order for this to work properly.

Comments (1)