Reputation: 1
I have Web-Developer Server Suite, with PHP 5.25, which I downloaded from SourceForge. My operating system is Windows 7 Home Edition.
I upgraded Apache to the latest version and will be upgrading PHP to 5.38 soon.
It works well, apart from one small problem; virtual hosts outside the main webroot (C:/www/vhosts) do not display PHP scripts, or indeed any scripts at all; just the plain code. All virtualhosts work within C:/www/vhosts, but not any of the other locations I've declared in vhosts.
The other locations are:
This is despite the fact I declared the locations in httpd-vhosts.conf !
How would I get the server to understand PHP outside the main webroot, and also ASP.NET
(bear in mind I added mod_aspdotnet as well).
I'd gladly appreciate any advice on this; just spent a day-and-a-half rebuilding my webserver, moving files from a backup (all PHP and MySQL) after reinstalling Web-Developer Server Suite (which, IMHO, is pretty good for a beginner).
I'm not sure where to go with this, but I'll add, just for relevance, that this is strictly a development server for testing.
Upvotes: 0
Views: 802
Reputation: 2981
You can place your scripts in protected directory outside your Webroot so they are not accessible by your visitors.
However you need to place a script in your Webroot, that include these scripts. Most of the Firmwares implement a similar functionality.
<?php
require_once('/var/usr/myConfigDir/config.php');
?>
As I understand, only the directory configured as Webroot will be able to execute scripts. Already Apache adds a security layer for not executing scripts outside Webroot.
So if your target is to protect some of your scripts, you can do that, otherwise, I don't think it's possible.
Upvotes: 1
Reputation: 406
From my understanding of your question, you want to be able to have your PHP files anywhere on your computer, yet have them still be able to execute. I do not believe this is possible, as PHP files are opened through the webserver i.e 127.0.0.1/foo.php instead of file://foo.php/
The webserver is configured to execute the files in /www, unless there is a setting somewhere (which I am unaware of) all PHP scripts will have to rest in /www.
Upvotes: 0