Categories
CentOS

Install the PHP DOM Extension on CentOS – the Easiest Way

Here we cover the fastest, most effective way to get the PHP DOM extension installed on CentOS. If you’ve just found out you need to install this extension, but don’t really know what it is, we’ve included some background first.

What is DOM?

“The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTMLXHTML and XML documents.” (Source: DOM in Wikipedia.)

What is PHP DOM extension?

“The DOM extension allows you to operate on XML documents through the DOM API with PHP 5.” (Source: Introduction to the PHP DOM Extension on php.net.)

How to install the PHP DOM Extension on CentOS

You will need superuser privileges. Run the following command:

sudo yum install php-xml

Don’t forget to restart Apache so PHP picks up the new extension:

sudo service httpd restart

How to Check PHP DOM is Installed

You can see PHP DOM is installed by creating a simple web page that calls the phpinfo() function:

<?php phpinfo(); ?>

When you go to this webpage in a browser, you should see this output for the dom extension if it’s installed:

dom

DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.26
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled

Tested on CentOS 5.3.

Categories
CentOS

How to Install Vim on CentOS

To install vim, run the following command from a CentOS shell:

sudo yum install vim-enhanced.i386

Tested on CentOS 5.3 (32 bit).

How to Find the Yum Package for Vim

To find the command, run:

yum search vim

The gives you the different packages mentioning vim:

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* rpmforge: ftp-stud.fht-esslingen.de
================================================================================= Matched: vim =================================================================================
vim-X11.i386 : The VIM version of the vi editor for the X Window System.
vim-common.i386 : The common files needed by any version of the VIM editor.
vim-enhanced.i386 : A version of the VIM editor which includes recent enhancements.
vim-minimal.i386 : A minimal version of the VIM editor.
Categories
CentOS

How to Find Your CentOS Version

Someone’s given you a CentOS server to do some work on, perhaps putting up a website. “What version of CentOS is it running?”, you ask. “I don’t know” is a pretty common answer, or “version 5, I think”.

The CentOS version tends to indicate the rough age of the software (e.g. Linux kernel, PHP, MySQL) you’ll be using.

Here’s how you can check the CentOS version directly.

Find the CentOS Version

If you want to know what version of CentOS its running.

To check, cat the /etc/issue file:

[root@bijango ~]# cat /etc/issue
CentOS release 5.3 (Final)
Kernel \r on an \m

Note the contents of /etc/issue is displayed when someone creates a terminal session on the server,
so the system administrator may have edited this file to put in a different message, and potentially deleted the CentOS version information.

This was of checking the Linux distro version was tested on CentOS 5.2, CentOS 5.3, Ubuntu 8.10 and Ubuntu 10.10.

This way of checking the OS version would probably work on Red Hat Enterprise Linux and Debian as well. This is because CentOS is a clone of Red Hat, and Ubuntu is derived from Ubuntu.