Jump to content


page2pagepro

Member Since 05 Feb 2010
Offline Last Active May 17 2010 12:51 PM
-----

Topics I've Started

Proposed Improved PHPINFO() with Loaded Extensions information

13 May 2010 - 03:14 PM

Purpose is to improve the native phpinfo() function to something a bit more specialized.
  • Assumed %top% to be UniServer Root Installation folder/directory
  • Replace code in file %top%\home\admin\www\phpinfo.php with:
  • <?php
    	/**************************************************************************\
    		Contributors:
    			http://nevstokes.com/blog/2009/06/23/a-better-phpinfo/
    			http://www.page2pagepro.com/a-better-phpinfo/
    	\**************************************************************************/
     
    	$options = array('CONFIGURATION', 'ENVIRONMENT', 'MODULES', 'EXTENSIONS', 'VARIABLES', 'GENERAL', 'CREDITS', 'LICENSE', 'ALL');
    	$display = (empty($_GET['display']) || !in_array(strtoupper($_GET['display']), $options)) ? 'ALL' : strtoupper($_GET['display']);
     
    	$navigation = array();
     
    	foreach($options as $key=>$value) {
    		$navigation[] = ($value != $display) ? '<a href="' . $_SERVER['SCRIPT_NAME'] . '?display=' . $value . '">' . $value . '</a>' : '<strong>' . $value . '</strong>';
    	}
     
    	ob_start();
     
    	switch($display) {
    		case 'CONFIGURATION':		
    			phpinfo(INFO_CONFIGURATION);
    			break;
     
    		case 'ENVIRONMENT':
    			phpinfo(INFO_ENVIRONMENT);
    			break;
     
    		case 'MODULES':
    			phpinfo(INFO_MODULES);
    			break;
     
    		case 'VARIABLES':
    			phpinfo(INFO_VARIABLES);
    			break;
     
    		case 'GENERAL':
    			phpinfo(INFO_GENERAL);
    			break;
     
    		case 'EXTENSIONS':
    		case 'CREDITS':
    			phpinfo(INFO_CREDITS);
    			break;
     
    		case 'LICENSE':
    			phpinfo(INFO_LICENSE);
    			break;
     
    		case 'ALL': default:
    			phpinfo();
    			break;
    	}
     
    	$content = ob_get_clean();
     
    	if (($display) == 'EXTENSIONS') {
    		$str = '<body><div class="center">';
    		$content = substr($content, 0, strpos("$content$str", $str)+strlen($str));
    		ob_start();
    		echo '<h2>Overview</h2>'.PHP_EOL;
    		echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL;
    		echo '<tr><td class="e">Extensions</td><td class="v">'.PHP_EOL;
    		$exts = array();
    		foreach (get_loaded_extensions() as $ext) {
    			$exts[] = $ext;
    		}
    		echo implode(', ', $exts).PHP_EOL;
    		echo '</td></tr></table><br />'.PHP_EOL;
    		echo '<h2>Details</h2>'.PHP_EOL;
    		echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL;
    		foreach ($exts as $ext) {
    			echo '<tr><td class="e">'.$ext.'</td><td class="v">';
    				$funcs = array();
    				foreach (get_extension_funcs($ext) as $func) {
    					$funcs[] = $func;
    				}
    				echo implode(', ', $funcs).PHP_EOL;
    			echo '</td></tr>'.PHP_EOL;
    		}
    		echo '</table><br />'.PHP_EOL;
    		echo '</div></body></html>'.PHP_EOL;
    		$content .= ob_get_contents();
    		ob_end_clean();		
    	}
     
    	echo str_replace('<body>', '</body><body><div class="center options"><p>' . implode(' | ', $navigation) .'</p></div>', $content);
    ?>
  • Code is found with syntax-highlighting (Geshi) at Page2PagePro.com
Please let me know if you have any other additions to this project.

Thanx!

HOW-TO: XSL Extension Installation for UniServer Nano 5.6.5

13 May 2010 - 03:06 PM

The purpose of this article is to allow XSL support on UniServer PHP
  • For this document - Assume %top% to be root of the UniServer Installation Folder
For reference I am using Nano 5.6.5 Version housing PHP 5.3.2

From my research, UniServer implements PHP Thread-Safe x86 VC6.

Steps:
  • Download php-5.3.2-Win32-VC6-x86.zip
  • Extract ext/php_xsl.dll from zip to %top/usr/local/php/extensions
  • Remove semi-colon from line ;extension=php_xsl.dll in files:
    • php.ini
    • php.ini_delvelopment_nano
    • php.ini_production_nano
    • php-cli.ini is OPTIONAL for Command-Line-Interface. Add the line if required.
  • Test - I used the files listed on XSL-PHP Example
Please provide comments if a more efficient method is introduced.

HOW-TO: ASP DOT NET Module for UniServer Nano 5.6.5

13 May 2010 - 02:42 PM

Tested to work with 'hello-world.aspx'.

Here are my steps for getting ASP to work with Uniform Server 5.6.5

Variables used for this how-to.
  • %top% is assumed your path to the root of UniServer Installation
  • Temporarily rename %top%\usr\local\apache2\bin\Apache.exe to httpd.exe
  • Download mod_aspdotnet-2.2.0.2006-setup-r2.msi
  • Install module to %top%\usr\local\apache2 (All this does is install mod_aspdotnet.so to apache2\modules folder and adds manual to apache2\manual, and of course adds registry entries)
  • Make a copy of mod_aspdotnet.so to _mod_aspdotnet.so
  • Uninstall "mod_aspdotnet for Apache HTTP Server 2.2" - removing 'all' trace from the computer.
  • Rename _mod_aspdotnet.so to mod_aspdotnet.so
  • Rename httpd.exe back to Apache.exe
  • Add following to the BOTTOM of your %top%\usr\local\apache2\conf\httpd.conf
    • #asp.net
      LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
      AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
      <IfModule mod_aspdotnet.cpp>
      # Mount the ASP.NET /asp application
      AspNetMount /asp "%top%/www/asp"
      #/SampleASP is the alias name for asp.net to execute
      #"c:/SampleASP" is the actual execution of files/folders in that location

      # Map all requests for /asp to the application files
      Alias /asp "%top%/www/asp"
      #maps /SampleASP request to "c:/SampleASP"
      #now to get to the /SampleASP type http://localhost/SampleASP
      #It'll redirect http://localhost/SampleASP to "c:/SampleASP"

      # Allow asp.net scripts to be executed in the /SampleASP example
      <Directory "%top%/www/asp">
      Options FollowSymlinks ExecCGI
      Order allow,deny
      Allow from all
      DirectoryIndex index.htm index.aspx
      #default the index page to .htm and .aspx
      </Directory>

      # For all virtual ASP.NET webs, we need the aspnet_client files
      # to serve the client-side helper scripts.
      AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
      <Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
      Options FollowSymlinks
      Order allow,deny
      Allow from all
      </Directory>
      </IfModule>
      #asp.net
  • Restart Server
  • Place your hello-world.aspx in folder %top%/www/asp
  • Please provide feedback if you find a simpler method.
I have not tested beyond *BASIC* functionality of the mod. Please, if you have an involved ASP script, please try it out and share your results.

thanx!

USB Installation AutoRun and Drive Letter Changing

05 February 2010 - 09:27 AM

G'day!

I how found that hard-coding Drive letter in config files (httpd.conf, ssl.conf, my.ini, php.ini, etc.) can lead to issues when you migrate a USB-key installation to another PC.

I work on projects on multiple PC's and wanted the system to recognize what relative path it was on, then adjust according.

My solution is as follows (If anyone has alternative and/or better solution, please share):
This is for Windows 9X, 2K and XP (Vista not verified)

Step 1: Install like normal
Step 2: Change references to %drive-letter%:/ to simply a backslash in 'main' config files
Step 3: Create Start.bat file in UniServer Folder on USB drive with following lines:
@echo off
pushd %~dp0
start %~dp0Start.exe
popd
Step 4: Create autorun.inf in root of USB drive with following lines:
[autorun]
open=UniServer\Start.bat
icon=UniServer\Start.exe
action=Start Uniform Server
LABEL=UniServer
UseAutoPlay=1
Step 5: Done!

Explanation:
The reason we create the autorun.inf is to allow a custom auto-run.
The reason we use the batch file in lieu of the executable is that I've experienced that accessing the Start.exe directly from the autorun.inf is unsuccessful. I believe it may have to do with the way the CWD (current working directory) info is relayed to the executable from the autorun file. The batch file switches to current directory and 'pops' it back to normal. I realise this is kinda a hack, but I can dynamically change drive letter of the USB-key on any PC and with I insert the key, the autorun.inf works without a hiccup.

Thank you for your time!
-page2pagepro.com