Top Nav

Determine PHP Version

How can I determine what version of PHP is running on my server?

If you have command line access to the server then type:

or

And you’ll get a result similar to this:

Be careful using this approach. It is possible that there is more then one install of PHP on your server and the webserver may be using an install that is not in your command line path.

Use the whereis command to check for multiple installs like this:

Notice the second install at /usr/local/bin/php. If we check the version of the second install we might get different.

Another way to determine the version is to create a test page on the webserver.

Place the following line in the file:

Call the file “test.php”. Next with a web browser access the file with:

http://www.myserver.com/test.php

You’ll get back an extensive report on the configuration of the PHP install on the server. The PHP version will be shown in the title at the top of the report.

Make sure you remove the test.php file after you are finished with it. The file contains information that could assist hackers so you don’t want to leave it sitting around.

3

Determine PHP Compile Settings

How can one determine what config settings were used to build PHP? This is a question that comes up when you want to upgrade to a new version of PHP and need to replicate the original settings. Another case is when you are setting of a development server that must be a mirror of your production server.

There are two good ways to proceed:

1. If folder where the source code was built is available then take a look at the file named “config.status”. At the top of this file you’ll find comments looking something like this:

The text in bold is the config line with all the options used.

2. The second method requires that you create a file on the server inside the webspace. Place the following line in the file:

Call the file “test.php”. Next with a web browser access the file with:

http://www.myserver.com/test.php

You’ll get back an extensive report on the configuration of the PHP install on the server. In the first section of the report, under the label “Configure Command” you’ll see something like:

Make sure you remove the test.php file after you are finished with it. The file contains information that could assist hackers so you don’t want to leave it sitting around.

0

DVD Backup With BackupEdge

On a server with a Sony DVD R/W drive and BackupEdge software – this tech note was used to configure the drive:

http://www.microlite.com/support/edgefax65.ts.html

Here’s a link to site that is full of DVD info:

http://fy.chalmers.se/~appro/linux/DVD+RW/

0

OpenNMS Install

OpenNMS is a great network monitoring tool. Here’s the OpenNMS site:

http://www.opennms.org

In this case I’m going to do an install on to a RedHat Fedora Core 1 server. Here’s the installation guide:

https://sourceforge.net/docman/display_doc.php?docid=23937&group_id=4141

The first step is to install the various prerequisites:

– Java 2 SDK 1.4.2 or later from http://java.sun.com

We did a stock install of the 1.4.2_07 tar/gz package to /usr/local/. Don’t forget to export the JAVA_HOME environment variable:

– Tomcat 4 from http://jakarta.apache.org/tomcat/index.html

We did a standard install of the 4.1.31 tar/gz package following the instructions here:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/RUNNING.txt

The install was placed at /usr/local/jakarta-tomcat-4.0.

We added the following lines to /etc/rc.local to start Tomcat on bootup and open the appropriate firewall ports:

At this point Tomcat was accessible at http://{myipaddress}:8080

– RRDTool from http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/

We used the 1.0.49 source tar/gz package and built it using the instructions in the enclosed README file. The package was installed to: /usr/local/rrdtool-1.0.49

Had to add a –enable-shared option to the configure command line to get the shared libraries to build.

Had to symlink rrdtool into /usr/bin so that opennms could find it:

ln -s /usr/local/rrdtool-1.0.49/bin/rrdtool /usr/bin/rrdtool

Also edited /etc/ld.so.conf and add “/usr/local/rrdtool-1.0.49/lib/” – the path to the rddtool shared libraries. Finally ran ldconfig to update the cache.

– PostgreSQL 7.2 or later from http://www.postgresql.org/

We used the 7.4.7 release and installed the following binary rpms:

postgresql-7.4.7-2PGDG.i686.rpm
postgresql-contrib-7.4.7-2PGDG.i686.rpm
postgresql-devel-7.4.7-2PGDG.i686.rpm
postgresql-docs-7.4.7-2PGDG.i686.rpm
postgresql-jdbc-7.4.7-2PGDG.i686.rpm
postgresql-libs-7.4.7-2PGDG.i686.rpm
postgresql-pl-7.4.7-2PGDG.i686.rpm
postgresql-server-7.4.7-2PGDG.i686.rpm
postgresql-tcl-7.4.7-2PGDG.i686.rpm
postgresql-test-7.4.7-2PGDG.i686.rpm

After installing we did the following commands to start the database and set it to start on bootup:

And that does it for the prerequisites.

We’ll now install OpenNMS, still following the instructions at:

https://sourceforge.net/docman/display_doc.php?docid=23937&group_id=4141

To keep the install simple we used the FC1 RPM binaries provided by OpenNMS. After downloading we had three files:

opennms-1.2.0-1_fc1.i386.rpm
opennms-docs-1.2.0-1_fc1.i386.rpm
opennms-webapp-1.2.0-1_fc1.i386.rpm

Next we tried to install the first rpm with:

rpm -i opennms-1.2.0-1_fc1.i386.rpm

We ran into some problems with missing dependancies at this point. First we had to install:

compat-libstdc++-7.3-2.96.118.i386.rpm

which was downloaded from RPMFind.

Then we installed with dependancies turned off.

rpm -i –nodeps opennms-1.2.0-1_fc1.i386.rpm
rpm -i opennms-docs-1.2.0-1_fc1.i386.rpm
rpm -i –nodeps opennms-webapp-1.2.0-1_fc1.i386.rpm

Many of the opennms files get installed to:

/opt/OpenNMS

Next we’ll setup the installer:

export OPENNMS_HOME=/opt/OpenNMS
$OPENNMS_HOME/bin/runjava -s

And run the installer:

$OPENNMS_HOME/bin/install -disU

This failed with jdbc errors about problems connection to postgres.

To fix it we added the following firewall rule:

iptables -A INPUT -s 127.0.0.1 -p tcp –dport 5432 -j ACCEPT

And modified the pg_hba.conf file to this:

local all all ident sameuser
host all all 127.0.0.1 255.255.255.255 trust

Now the installer ran properly.

Next we ran the installer for the webapps:

export CATALINA_HOME=/usr/local/jakarta-tomcat-4.0
$OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/webapps -W $CATALINA_HOME/server/lib

This worked without any problems.

Next we tried to start opennms with:

$OPENNMS_HOME/bin/opennms.sh start

This took a really long time to return and then reported that startup had failed. In fact startup worked it just takes several minutes.

We had to restart tomcat before we could get to the webapp at:

http://{myipaddress}:8080/opennms

The initial login was user “admin” and password “admin”

Finally we set opennms to start on boot with:

chkconfig –add opennms

0

Loops In XSL

1. Multiple looping within a report. Example: multiple UPS tracking numbers
to print in the footer of an invoice after detail lines have looped.

Loops are accomplished with xsl:apply-templates statements.

At the point in the document that you want the loop, insert an xsl:apply-templates tag with the select attribute set to the node that you want to loop on.

For example if you have tracking numbers in //report/tracking elements then use:

lt;xsl:apply-templates select=”tracking” />

At the end of the document you’ll want to define a template to render the tracking numbers. For example:

<xsl:template match=”//report/tracking” >
<fo:block><xsl:value-of select=”@number” /></fo:block>
</xsl:template>

Here’s what the xml might look like:

<report>
<tracking number=”123″ />
<tracking number=”456″ />
<tracking number=”789″ />
</report>

So for each loop, create a template that renders the looped item and add an apply-templates element at the point where you want the template inserted.

There is also ans xsl:for-each looping construct. It works inline without the need for an additional template. with the example data above we could do:

<xsl:for-each select=”//report/tracking”>
<fo:block><xsl:value-of select=”@number” /></fo:block>
</xsl:for-each>

You can have as many loops as you want.

2. Sub loops within loops. Example: each line item on an invoice could have
multiple lot numbers that need to be printed with everything that’s
associated with those lots (Country of Origin, Date of Mfg, Manufacturer…)

Loops as describe above can be nested. For-each element can be nested inside of each other. An xsl-template can contain calls to xsl:apply-templates.

0