Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

functions to test MySQL version and if mod_rewrite installed

Posted on 2006-06-12
5
Medium Priority
?
547 Views
Last Modified: 2008-02-01
I need two functions.

1. Function that accepts input version number.  Returns true if the server MySQL version is equal to or greater than the input version.
2. Function that returns true if mod_rewrite is installed on the server.

0
Comment
Question by:killer455
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Accepted Solution

by:
JakobA earned 100 total points
ID: 16891920
1) check mysql version
see: http://dk2.php.net/manual/en/function.mysqli-get-server-version.php

fx:

function checkMySQL( $main, $minor, $sub ) {
    $temp = $main*10000 + $minor*100 + $sub;
    if( $temp <= mysqli-get-server-version( $mysql_conn ) ) {
        return true;
    } else {
        return false;
    }
}
// so if you require 4.1.4 or later:
if ( checkMySQL( 4, 1, 4 ) ) {
    // Yes the SQL is new enough
}

2) to see if mod_rewrite is installed.

<?php
if ( isset( $_ENV['SCRIPT_URL'] ) && isset( $_ENV['SCRIPT_URI'] ) ) {
    // Yes, this is an Apache server with mod_rewrite installed
}
// not entirely safe. environment variables with those names might be created in any
// operating system for other reasons :(
?>

I do not really see the need for this test. It is a once only test (when you place your script on the server), so why not just put a variable in your standard include file?

regards JakobA
0
 

Author Comment

by:killer455
ID: 16895159
I do not really see the need for this test. It is a once only test (when you place your script on the server), so why not just put a variable in your standard include file?

The point was to test the server before installing the script.  Would the extension_loaded php function work?

0
 
LVL 5

Assisted Solution

by:aminerd
aminerd earned 100 total points
ID: 16896600
extension_loaded is for PHP extensions -- not Apache modules.

This should work:

$mod_rewrite = in_array('mod_rewrite', apache_get_modules());
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question