Hi, Is there a way - in PHP - to get the name of the virtual dir originally used in the calling URL? I've tried every server variable listed, both for IIS and PHP, to try to get it. They always return the resolved URL, i.e. not containing the name of the virtual
dir. REQUEST_URI etc are no help. I'm setting up mediawiki to support multiple wikis using common source. I just adjust which xxxxLocalSettings.php gets called based on the calling URL. Should be simple, if I can just detect what virtual directory was specified.
Or is there a better way? I set up the virtual directories just so that the server accepts the URL. The default wiki works fine, since it gets set and called if no other wiki name is detected in the URL (which is always, right now). Any help much appreciated!
Pete
Thanks for the response, but I'm not sure it helps. Mediawiki and PHP in ISS are working fine. I'm working in PHP to try to detect if the calling URL used a virtual directory, and if so, which? My PHP code will then be able to select the correct LocalSettings.php
to use to kick off the correct instance of mediawiki. I already went through all the likely server variables indicated by phpinfo() but none return anything containing a virtual dir name. Cheers Pete
Thanks again. I've been through much of the php docs, but this is more related to what is being passed from the server. So functions to manipulate directories don't really help. I don't think I've explained myself very well. I have everything working. I can
even manually rename the LocalSettings.php in order to start whatever instance of mediawiki I like. All I'm trying to do is have my code detect what URL was used in the call, so it can do the same. My trouble is that I can find no server variable that contains
the virtual dir as part of the path - they all just return the resolved path, i.e. lacking the virtual directory, so I've nothing to use to determine what .php to call. For example: Actual path: \mywiki. Virtual path: \mywiki\wikione (points to \mywiki). Virtual
path: \mywiki\wikitwo (points to \mywiki). User accesses wiki my calling http:\\x.x.x.x\mywiki\wikione. LocalSettings.php searches calling URL for 'wikione' string. If found. starts mediawiki with wikione settings. So I need to know the calling URL - but how?
The virtual dir isn't present. Thanks! Pete
MySQL The Database and Engine Database ( MediaWikiUsers(N) ).
Create a Wiki ( N ) MediaWikiUsers(N)).
cd /d C:\php (i.e. the location of your php root directory)
md session
md uploadicacls session /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)icacls upload /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)From the base configuration
file provided by PHP, you will need to modify your php.ini to have the following definitions:
upload_tmp_dir="C:\php\upload"
session.save_path = "C:\php\session"
3. Enable PHP support for MySQL. Modify your php.ini to define the extensions directory and uncomment the PHP MySQL extension definition:
extension_dir = "C:\php\ext" (i.e. the location of your php extensions directory)
extension=php_mysql.dll
3. Once you enter all the required information, click "Install MediaWiki!". The configuration page creates the database wikidb and saves your settings in the
%SystemDrive%\Inetpub\wwwroot\MediaWiki\config\LocalSettings.php file.
4. Move the LocalSetting.php file to the %SystemDrive%\Inetpub\wwwroot\MediaWiki\ folder and delete the folder %SystemDrive%\Inetpub\wwwroot\MediaWiki\config from your system.
5. LocalSetting.php contains sensitive information, so secure it by revoking access to unnecessary identities.
Open a Command Prompt window with administrator privileges and run the following command:
Create a web.config file in the same folder where MediaWiki files were installed and paste into it the following
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MediaWiki">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?title={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Update the LocalSettings.php file as follows: ## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/MediaWiki";
$wgScriptExtension = ".php";
$wgArticlePath = "${wgScriptPath}/$1";
5. Go to the main page and click the Edit link. An Editor displays in which you can make your changes. When done with changes, click "Save Page".
Here is the modified page.
Does it work ?
Update this with your results.
You can post the detailed Status Sub status codes to be checked in the Forum.
Cheers:)
Martin Rasch
Windows and Linux work Together IT-Pros
Community Member Award 2011
Thanks for the replies Martin. My problems are solved. In fact, many of the problems I've been experiencing seem to suddenly be ok after applying a heap of Windows Update patches to the server... moral of the story; make sure your server group keep your servers
up to date!
healdp
11 Posts
IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 09:50 PM|LINK
PHP iis mediawiki virtual
HCamper
8048 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 10:18 PM|LINK
Hi,
Yes http://learn.iis.net/page.aspx/944/using-php-manager-for-iis-to-setup-and-configure-php/ install the PHP Manager.
You can check or change the php.ini settings.
You might be having problems with the Media Wiki settings for IIS Server http://learn.iis.net/page.aspx/299/mediawiki-on-iis/ ?
Cheers :)
Martin
Community Member Award 2011
healdp
11 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 10:36 PM|LINK
HCamper
8048 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 10:54 PM|LINK
Hello,
The PHP Manager helps to make sure the php.ini settings work correctly.
The Media Wiki and other PHP based applications like to modify the php.ini configuration.
The PHP manual realpath http://php.net/manual/en/function.realpath.php .
Have you checked the PHP Manual Functions section http://www.php.net/manual/en/class.dir.php ?
You should look at the PHP Security information and the php.ini http://php.net/manual/en/ini.core.php settings.
Martin
Community Member Award 2011
healdp
11 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 11:11 PM|LINK
HCamper
8048 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Jan 06, 2012 11:28 PM|LINK
Hello,
If you need "a server variable foo_path that contains the virtual dir C:\foo"
PHP - to get the name of the virtual dir originally used in the calling Collections with mthods. ok.
The Rules based on a URL Match could be every server variable listed *Design * and use. ok.
--both for IIS and PHP to try to get check for the expections to the Rules
They always return the resolved Based on the URL Collections not containing the name of the
*design* the relative or absloute - virtual (dir) --path that is not correct. ok.
The Rules for the REQUEST_URI might fail based on the computer name Bios -Sessions * shug* HCek for the worst
case Mediawiki declare this as the the Collections ( to support ) multiple Mediawiki ( wikis ) using
common source PHP variable * design*.
Which (xxxx) of the set regexp ( matches) LocalSettings you can use PHP gets Match URL Rules called based on the
A rough * design * using the existing PHP language Functions(). ok
Collections and ( calling ) the * form * = Server-variable you have to work frrom.
URL Rules and the Match Should be simple-detect.
What virtual directory Media Wikie xxxx in the Collections * database* variables.
Was designed iinto the specified the Collections ( I set up the virtual directories ) Just so that the server
accepts Server-Variables to use: Match the Rules and using Methods as needed PHP for this
URL Collections (The default wiki works fine ) Ok.
Since it gets set in the Collections ( and called if ) no other Match the ( wiki name Rule not Matched ( is not Trueset to "null") ok.
Exceptions to the Rules need to be detected. Based on the Collections and the Rules and the URL Match Sets Rules Design Methods. ok.
Collections PHP Methods the Rules can change. The Methods right now is a plan and not a tested -design -untested looks logical. ok.
I hope this helps to explain I was in a rush and busy to full explain :D.
Martin Rasch
Community Member Award 2011
HCamper
8048 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Feb 08, 2012 06:13 PM|LINK
Hello,
I have posted a reply: PHP the Language and Functions can work. This is not IIS Server Problems.
You have a large collection of server-variables to consider for the Media Wiki using just PHP.
Regards,
Martin Rasch
Community Member Award 2011
HCamper
8048 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Feb 09, 2012 11:00 AM|LINK
Hello,
The Mediawiki and PHP MySQL are working fine. ok.
Install Log Parser set-up the logs. ok.
Look at this : MediaWiki on IIS http://learn.iis.net/page.aspx/299/mediawiki-on-iis/
A rough plan:
The Collection MediaWiki(N) Hosting (Rules) Creation (Rules) Tests detection.
The Status Codes Collection : (Numbers, Status Substatus( N.xx) , Descriptions, Optional Suggestions.
Testing Log Parser Install on Windows setup the logs.
Check the Logs http://support.microsoft.com/kb/943891 Does it work. ?
"How-To-Conversion-"Linux"-"Windows"-Untested"
PHP the Language and Functions()
MySQL The Database and Engine Database ( MediaWikiUsers(N) ).
Create a Wiki ( N ) MediaWikiUsers(N)).
cd /d C:\php (i.e. the location of your php root directory)
md session
md uploadicacls session /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)icacls upload /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)From the base configuration file provided by PHP, you will need to modify your php.ini to have the following definitions:upload_tmp_dir="C:\php\upload"
session.save_path = "C:\php\session"
extension_dir = "C:\php\ext" (i.e. the location of your php extensions directory)
extension=php_mysql.dll
icacls %SystemDrive%\Inetpub\wwwroot\MediaWiki\config /grant BUILTIN\IIS_IUSRS:(W)
When hosting MediaWiki on IIS 7.0, it is possible to configure MediaWiki to use URLs without query string by following these steps:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MediaWiki">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?title={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/MediaWiki";
$wgScriptExtension = ".php";
$wgArticlePath = "${wgScriptPath}/$1";
Update this with your results.
You can post the detailed Status Sub status codes to be checked in the Forum.
Cheers:)
Martin Rasch
Community Member Award 2011
healdp
11 Posts
Re: IIS on WinServer2008R2 using PHP to get name of virtual dir
Feb 22, 2012 09:24 PM|LINK