I leased a new server from ThePlanet.com today. It came prebundled with cPanel. Boy is this cPanel messy. That interface is so complicated, I’d rather deal with Linux config files. Almost.
Anyhow. Confusion with web directory came up as soon as I installed it. I looked up /etc/httpd/httpd.conf and immediatelly changed the DocumentRoot to /home/site, because that’s how I set all my servers. Restarted httpd and nothing. Took some searching to find that DocumentRoot did not matter as I was supposed to change things on the bottom of the file:
NameVirtualHost my.ip.address:80<VirtualHost my.ip.address>
Hmm. It worked.
cPanel allows you to add packages to Apache/PHP. That’s very useful. I immediately added GD, and mbstring. That’s located in WHM (WebHost Manager) under Software > Apache Update. Pick the version of PHP and packages you want to add compile and with a click of a buttom the script will download and compile them. Now, that was great!
Open /etc/sysconfig/rhn/sources and add this line for a repository where appropriate.
yum dag http://apt.sw.be/redhat/el4/en/$ARCH/dag
I didn’t ‘up2date’ the whole system fearing that it may break cPanel. Instead I just issued:
up2date -i sqlite
Few moments later I tested the command ‘sqlite’ from the shell and sure enough I got the sqlite shell. Exit it with ‘.exit’ command! I had to search for it 🙂
But, that was only sqlite 2.8, so I decided to install the test version of 3.3. I found one at http://dag.wieers.com/rpm/packages/sqlite/
I downloaded it and installed issuing commands:
rpm -i sqlite-3.3.13-1.el4.test.i386.rpm
I have both a 2.3.17 (command ‘sqlite’) and 3.3.13 (command ‘sqlite3’)
I’ll be using sqlite on as-need basis, so I decided to dynamically load it in my code.
pear install SQLite-1.0.3.tgz
This caused an error, something about PHP_AUTOCONF not being initialized. So, do it with this command:
Then finish it manually:
Find what your PHP extensions directory is. It’s defined in php.ini file as extension_dir setting. My php.ini file is located in /usr/local/lib/php.ini. It turns out the extension directory is ‘/usr/local/lib/php/extensions/no-debug-non-zts-20020429/’.
Find the sqlite.so file on the filesystem and you can copy it to extensions directory:
cp sqlite.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429/
Newer cPanels come with MySQL 5 support. Open WHM and go to Server Configuration > Tweak Settings. Choose MySQL 5 and Save!
Once MySQL is upgraded you may test the version from the shell, by issuing command:
Next, we have to rebuild the php driver for mysql. In WHM, under Software, click Apache Update, click ‘Load previous config’, optionally select modules to load and click ‘Start Build’! Pretty easy, if you follow this step by step.
Dissallow root login
Open /etc/ssh/sshd_config in your editor of choice and find a line PermitRootLogin and set it to ‘no’.