Dotster VPS Upgrade to PHP 5 and MySQL 5

May 7, 2007 | 8 Comments

I recently purchased a Dotster VPS and needed to get it upgraded to have PHP 5 and MySQL 5, rather than version 4 of both. These machines run CentOS, so the best plan was to use yum.

Unfortunately, yum is not installed initially, so the first step was to get and install all the prerequisites plus yum:

export MIRROR=http://mirror.centos.org/centos/4/os/i386/CentOS/RPMS/
wget ${MIRROR}python-sqlite-1.1.7-1.2.i386.rpm
wget ${MIRROR}sqlite-3.3.3-1.2.i386.rpm
wget ${MIRROR}python-urlgrabber-2.9.8-2.noarch.rpm
wget ${MIRROR}python-elementtree-1.2.6-4.2.1.i386.rpm
wget ${MIRROR}yum-2.4.3-1.c4.noarch.rpm

rpm -Uhv python-elementtree-1.2.6-4.2.1.i386.rpm
rpm -Uhv python-urlgrabber-2.9.8-2.noarch.rpm
rpm -Uhv sqlite-3.3.3-1.2.i386.rpm
rpm -Uhv python-sqlite-1.1.7-1.2.i386.rpm
rpm -Uvh yum-2.4.3-1.c4.noarch.rpm

Once that is in place, you need to enable CentOS Plus. Go into /etc/yum.repos.d/CentOS-Base.repo and under [centosplus] change “enabled=0″ to “enabled=1″.

Now you can simply execute ‘yum update’ and it should install both MySQL 5 and PHP 5 with all the necessary prerequisites (plus a number of other things…)

Update: A few other things to do:

  • Remove /etc/php.d/ioncube-loader.ini This file will cause weirdness with PHP and throw “Failed loading /usr/lib/php4/php_ioncube_loader_lin_4.3.so: /usr/lib/php4/php_ioncube_loader_lin_4.3.so: undefined symbol: zend_hash_add_or_update” in /var/log/httpd/error_log
  • Change php.ini memory_limit to be increased from the default of 8M, I recommend at least 32MB
  • Tune your MaxClients setting in /etc/httpd/conf/httpd.conf I couldn’t begin to make a recommendation here…

Do this at your own risk, this could mess up your entire system. Be sure to have a good backup before starting this process.

cent os, centos, centos plus, centosplus, dotster, dotster vps, mysql, mysql 5, php, php 5, unix, vps, yum

Tags: , , , , , , , , , , , ,

Related:

Luminis Statistics from Uportal

February 23, 2007 | 3 Comments

Note: this is a reposting of an article I wrote on LumDev.net April 12, 2005. I am publishing it here because LumDev is currently experiencing technical difficulties. I have not updated this post in any way to reflect new versions or practices. It is still the 2005 article in every way. I would highly recommend reading that article’s commentary if LumDev.net is available when you are reading this.

As many of us who use and administer Luminis know, the stats are quite inadequate straight out of the box. There are some improvements in III.2, but they are still not enough. Some posts on here have suggested some other solutions that gain some ground. I have been instead researching Uportal’s build in StatsRecorderFactory support. After a lot of trouble initially getting this enabled, Grace Francisco at SCT support was finally able to get me what I was missing to try this out. The following is an account of how to enable these stats outlining what I like and don’t like about this solution. In short this is useful, but short of perfect.

1) cd CP_WEBINF/config
2) jar xf ../lib/uPortal.jar properties/portal.properties –> this actually will get picked up by our classpath, and much easier than editing the file, and rejarring it back to uPortal.jar
3) cd properties
4) edit portal.properties
5) change

#org.jasig.portal.services.stats.StatsRecorderFactory.implementation=org.jasig.portal.services.stats.DoNothingStatsRecorderFactory
to
org.jasig.portal.services.stats.StatsRecorderFactory.implementation=org.jasig.portal.services.stats.LoggingStatsRecorderFactory

6) turn the stat recorder settings ON, if you scroll down a few lines you can choose which ones you want.

7) bounce the webserver:
CP_ROOT/bin/rc/70-webserver stop
CP_ROOT/bin/rc/70-webserver start

8) add logging settings to CP_WEBINF/config/cplog4j.properties
# - STATS-RECORDER
log4j.logger.uportal=INFO, stats
log4j.appender.stats=org.apache.log4j.RollingFileAppender
log4j.appender.stats.File=${util.logservice.log4j.directory}/stats.log
log4j.appender.stats.MaxFileSize=10000KB
log4j.appender.stats.MaxBackupIndex=10
log4j.appender.stats.layout=org.apache.log4j.PatternLayout
log4j.appender.stats.layout.ConversionPattern=[%d{ISO8601}] %m%n

These are some of the log entries created in stats.log:
[2005-03-18 17:10:11,828] [INFO] WebServlet [uportal]: STATS-RECORDER: (cpadmin) logged in successfully at Fri Mar 18 17:10:11 MST 2005
[2005-03-18 17:10:30,937] [INFO] WebServlet [uportal]: STATS-RECORDER: Channel [E-mail Channel, 221, u11l1n13] was rendered in layout 1 by (cpadmin) at Fri Mar 18 17:10:30 MST 2005
[2005-03-18 17:10:30,937] [INFO] WebServlet [uportal]: STATS-RECORDER: Channel [Personal Announcements, 210, u11l1n14] was rendered in layout 1 by (cpadmin) at Fri Mar 18 17:10:30 MST 2005
[2005-03-18 17:10:30,937] [INFO] WebServlet [uportal]: STATS-RECORDER: Channel [Campus Announcements, 211, u11l1n15] was rendered in layout 1 by (cpadmin) at Fri Mar 18 17:10:30 MST 2005
[2005-03-18 17:10:30,937] [INFO] WebServlet [uportal]: STATS-RECORDER: Channel [My Headlines, 212, u11l1n17] was rendered in layout 1 by (cpadmin) at Fri Mar
[2005-03-18 17:12:43,015] [INFO] WebServlet [uportal]: STATS-RECORDER: Session destroyed for (cpadmin) at Fri Mar 18 17:12:43 MST 2005

The first major limitation of this is that it is logging all the stats in a file. So in my instance I am running a cron’d process hourly to go in and pick up the stats files, parse them, and load them into Oracle. My table structure is attached so that you can see the sort of info I’m am acquiring. The script I’ve written is in PHP and if anyone is really interested, I could share that as well. In a perfect world, there would be a Stats Recorder for Oracle, so that it could go straight in without the extra steps. Someone has written RDBMStatsRecorder which hits Postgres. That may be a good base for building an Oracle version. (Google search RDMBStatsRecorder to find out more).

The second limitation is that it is logging all the STATS-RECORDER entries into the cp.log as well as stats.log. This makes for a very dirty cp.log. Someone who knows more about log4j may be able to explain how to resolve this. I unfortunately do not…

The third limitation is that there is not a way to track what tabs are being accessed. This is an important statistic for a bunch of reasons. I reported this desire to support and they entered Enhancement Request #26422 on my behalf. Another option would be to try and glean these from the webserver logs, but of course then you would not have a username and associated role to tie to these stats, so I’m not certain how useful that might be… Better than nothing though.

You can see my PHP code here: http://my.plymouth.edu:81/code/stats.phps

cplog4j, java, luminis, PHP, statistics, stats, stats-recorder, sungard, sungardhe, uportal

Tags: , , , , , , , , ,

Related:

Armenian Junior Web Developer Falls Off A Mountain

June 22, 2006 | 1 Comment

Armenian Junior Web Developer Falls Off A Mountain

Tim Haroutunian is working with us this summer in ITS at Plymouth State University as our Jr. Web Developer. Tim is an interesting character. He is quite proud of his Armenian heritage and at lunch explained in excruciating length about how while visiting Armenia he fell off a mountain. This story took a good 30 minutes to tell, but is summarized in it’s entirely above in the diagram. The diagram was brilliantly composed by Cliff.

Over the course of the summer we have all conspired to throw insane amounts of harrassment in hopes of thickening Tim’s skin. So far he is taking it well, we’ll find his breaking point though I’m sure.

(In quick defense of Tim, he is shaping up to be a pretty kick-ass PHP/Ajax/MySQL programmer)

ajax, armenia, armenian, cliff, mysql, php, time haroutunian, web developer

Tags: , , , , , , ,

Related:

PHP 5 readfile Problem

April 26, 2006 | 3 Comments

PHP LogoIn PHP 5.0.x there is a known bug that can cause large (2MB+) files to be handled incorrectly by the readfile function. We first discovered this while working with Tiki Wiki. Today we ran into it again with the way we stream secured SWF Flash files off the file system.

Luckily, I found this great function on PHP.net in the user comment section. Simply drop this function definition in place and use it instead of readfile and the problem is gone!

PHP:
  1. <?php
  2. function readfile_chunked($filename,$retbytes=true)
  3. {
  4.    $chunksize = 1*(1024*1024); // how many bytes per chunk
  5.    $buffer = '';
  6.    $cnt =0;
  7.    // $handle = fopen($filename, 'rb');
  8.    $handle = fopen($filename, 'rb');
  9.    if ($handle === false)
  10.    {
  11.        return false;
  12.    }
  13.    while (!feof($handle))
  14.    {
  15.        $buffer = fread($handle, $chunksize);
  16.        echo $buffer;
  17.        if ($retbytes)
  18.        {
  19.            $cnt += strlen($buffer);
  20.        }
  21.    }
  22.    $status = fclose($handle);
  23.    if ($retbytes && $status)
  24.    {
  25.        return $cnt; // return num. bytes delivered like readfile() does.
  26.    }
  27.    return $status;
  28. }
  29. ?>

code, development, file, file handling, flash, large file size, php, programming, readfile

Tags: , , , , , , , ,

Related:

EditPlus - The Greatest Text Editor

April 3, 2006 | 9 Comments

EditPlus ScreenshotEditPlus is unmatched in a crowded space of desktop text editors.

This is an application which gracefully handles syntax highlighting for any imaginable programming language. Part of the strength here is in the simplicity of defining highlighting rules. They are all defined in easy to understand text files which are a breeze to modify or supplement. Of course all the common ones are built-in (C, C++, Java, Java Script, PHP, Perl, ASP, HTML, CSS, etc) but there are also a ton of user contributed languages (Maya, Quake 2, Ada, QBasic, FoxPro, LaTex, and so many more).

For those who are interested, it also supports auto-completion files in a similar manner.

Another major win is it's ability to handle remote files through SFTP (or FTP) in such a way that they are no more difficult to work with than a local file. Other text editors try to accomplish and at least succeed at having the feature, but I've seen none that are as seamless to work with.

Keyboard shortcuts can be user defined, so any operation you find yourself doing regularly can quickly be mapped to your favorite keystroke. A huge win for developers.

Finally, the regular expression find and replace has made ad-hoc manipulation of text files something I can do without even thinking about it. All the fantastic abilities that surround this functionality add greatly to my comfort level with the product.

Unfortunately, I have on e criticism. There is no Mac version... This is most unfortunate to me, because EditPlus is the last reason I have for using Windows.

If you aren't already using EditPlus, and you are on a PC, try this text editor for awhile. You won't be sorry.

edit plus, editplus, text editor, editor, ide, sftp, syntax highlighting, regular expression, shortcut, php, css

Tags: , , , , , , , , , ,

Related:

Leveraging CAS with Luminis

March 28, 2006 | 4 Comments

In SunGard Higher Education's Luminis product one of the many add-on packages you can install is CAS support. CAS is an acronym for Central Authentication Service. This WebISO solution is one of the most common in higher education. CAS was created originally by Yale, but ongoing support has been taken over by JA-SIG. When the CAS package is installed in Luminis, it makes Luminis act as a CAS authentication provider. Coupled with this built-in Luminis support, we use a CAS library called phpCAS that adds to the simplicity of deploying this within our environment.

Time and again, CAS has been proven an effective and simple way for us to quickly drop authentication ability into our homegrown PHP applications. Once a function was developed, this was easily reused across dozens of applications within a few short months. The ease of deployment made it easy to convince various developers to switch from custom authentication schemes.

In a PHP application on any of the servers in your environment you can do something like the following:

PHP:
  1. <?php
  2.  
  3. function casify()
  4. {
  5.     // import phpCAS lib (http://esup-phpcas.sourceforge.net/)
  6.     include_once($GLOBALS['INCLUDES'].'/cas/CAS.php');
  7.  
  8.     // initialize phpCAS
  9.     phpCAS::client(CAS_VERSION_2_0,'luminis.institution.edu',443,'cas/');
  10.  
  11.     // check CAS authentication
  12.     phpCAS::forceAuthentication();
  13.  
  14.     // at this step, the user has been authenticated by the CAS server
  15.     // and the user's login name can be read with phpCAS::getUser().
  16.  
  17.     return phpCAS::getUser();
  18. }
  19.  
  20.  
  21. $username = casify();
  22.  
  23. // nothing past the execution of casify() would occur without acquiring a valid CAS ticket
  24.  
  25. ?>

Note: the preceding code is an example. There is more sophisticated functionality that can be accomplished using CAS, this is merely a starting point for people interested in this WebISO technology.

cas, development, education, higher education, identity management, jasig, luminis, php, phpcas, security, sungard, sungard higher education, web development, yale, yalecas

Tags: , , , , , , , , , , , , , ,

Related:

PHP 6 - The Magic is Gone

March 14, 2006 | 17 Comments

PHP LogoGranted PHP is only currently at 5.1.2 as the stable release, but we should always look forward to the future. The future is PHP 6. One of the big changes coming in 6 is a removal of many things that make PHP "magic".

According to ThePimp,net, register_globals, gpc_magic_quotes, and safe_mode have all been removed.

The register_globals change is an especially welcome enforcement. In PHP 4 it was discouraged, in PHP 5 it was deprecated. To be able to tell people it will be gone, not allowed, no other option in PHP 6 will give us leverage to finally eliminate the remaining stuff relying on register globals.

The removal of magic_quotes is more of a surprise to me. I previously was unaware that relying on this was discouraged, deprecated, or even bad practice. If the reasoning for removing this is just to eliminate the "voodoo" aspects of PHP, I can certainly agree with this. However, I'm still a bit uncertain as to why this is better. Although, I guess that it will simplify the need to strip_slashes all the time when repopulating fields and whatnot. Other thoughts?

Thankfully we haven't been using safe_mode, so this one is a non-issue.

Discussion of these major (much needed) changes in PHP came down from Rasmus Lerdorf himself back in August.

globals, gpc_magic_quotes, magic, php, php6, programming, register_globals, safe_mode, web, web development, PHP, rasmus lerdorf

Tags: , , , , , , , , , ,

Related:

Next Page »