Running latest Zend Server on Windows 7x64, I was playing around with different ways to sync htdocs into dropbox and edited two lines of httpd.conf.
DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs"
<Directory "C:\Program Files (x86)\Zend\Apache2/htdocs">
with various symlinks, dropbox locations, etc.
Put it back to the way it was and php includes and require no longer work. I know the scripts are fine as the exact same scripts work on my desktop with the exact same development environment.
I put all my usernames/passwords/database names/etc in a php file that is generally stored outside the htdocs directory.
require_once('constants.php');
(In the same dir for purposes of troubleshooting, have tried everything from $_SERVER to dir.
Throws this error:
Warning: require_once(1): failed to open stream: No such file or directory in C:\Program Files (x86)\Zend\Apache2\htdocs\index.php on line 17
Fatal error: require_once(): Failed opening required '1' (include_path='.;C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library') in C:\Program Files (x86)\Zend\Apache2\htdocs\index.php on line 17
Scripts are working fine on another machine with exact same software.
For the purposes of testing scripts, even require_once in same dir doesn't work.
Made a backup of httpd.conf before changing, put it back with no effect.
Copied httpd.conf off healthy machine, no change.
Completely re-installed the entire zend package twice, no change.
At a loss as to what could be causing this. Any ideas?
This is out of the box from the healthy machine, # removed:
DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs"
Each directory to which Apache has access can be configured with respect
to which services and features are allowed and/or disabled in that
directory (and its subdirectories).
First, we configure the "default" to be a very restrictive set of
features.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Note that from this point forward you must specifically allow
particular features to be enabled - so if something's not working as
you might expect, make sure that you have specifically enabled it
below.
This should be changed to whatever you set DocumentRoot to.
<Directory "C:\Program Files (x86)\Zend\Apache2/htdocs">
Possible values for the Options directive are "None", "All",
or any combination of:
Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
Note that "MultiViews" must be named *explicitly* --- "Options All"
doesn't give it to you.
The Options directive is both complicated and important. Please see
http://httpd.apache.org/docs/2.2/mod/core.html#options
for more information.
Options Indexes FollowSymLinks
AllowOverride controls what directives may be placed in .htaccess files.
It can be "All", "None", or any combination of the keywords:
Options FileInfo AuthConfig Limit
AllowOverride None
Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>
No quotes are used in Apache config IE:
ServerName yoursite.com
DocumentRoot C:\www\your_site
<Directory C:\www\your_site>
Options FollowSymLinks MultiViews
... rest of stuff
</Directory>
In addition your include may need the absolute path depending on you Apache settings .. IE
require_once('C:\www\your_site\outside_http_docs\constants.php');
Fixed it. Windows permissions requiring file outside the scope of htdocs.
Related
I'm running an Apache server on my computer through MAMP, and I can't seem to get it to read my .htaccess file. All of the solutions I've looked at have said to make sure that my AllowOverride is set to All in httpd.conf, which it is, but this doesn't seem to resolve my issue. I know that .htaccess isn't being read since I've written some nonsense at the start of the file and no error is being produced. I have also restarted the Apache servers after changing httpd.conf. Maybe the problem is that I'm not completely sure where I'm supposed to place the .htaccess file.
My MAMP document root was formerly MAMP > htdocs, but I changed it to Library > WebServer > Documents, which is where all of my PHP files are located. The current project I'm working on is a subdirectory of this, say Library > WebServer > Documents > project. This is the folder that contains my .htaccess file. My httpd.conf file is in MAMP > conf > apache, and the relevant section of it is as follows:
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
Do I need to change the directory from / to something else to get this working? Any help is really appreciated.
Edit: I added the following <VirtualHost> block to my httpd.conf following the comments below, but again, nothing seems to change:
<VirtualHost *:80>
ServerAdmin email#site.com
ServerName localhost:8890
DocumentRoot /
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Update (Solved): I was able to resolve the issue by reverting MAMP's DocumentRoot to its original MAMP > htdocs as opposed to my Library > WebServer > Documents. Apache is now reading the .htaccess file located in my MAMP > htdocs > project. Thanks everyone for the help.
First I would try to fix my VirtualHost to use the correct paths. I'm not super familiar with Mac, but if Library > WebServer > Documents > project corresponds to /Library/WebServer/Documents/project in your file system, then I would use that. Might be /home/your_username/Library/WebServer/Documents/project but as I said, I'm not a Mac guy. Next, I don't understand why you have directives for the same directory with opposite permissions, so I would try to remove the first Directory block or change the targetted directory to something else on one of the blocks. Note that you should never grant access to / with apache as it would be a very big security breach.
<VirtualHost *:80>
ServerAdmin email#site.com
ServerName localhost:8890
DocumentRoot /Library/WebServer/Documents/project
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory /Library/WebServer/Documents/project>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
If it still doesn't work, you might want to make sure that the filename Apache is looking for hasn't been changed to something else using the AccessFileName directive.
Also, you are not giving details on where you put the VirtualHost block, but if it is in a separate file. Make sure you are including that file somehow.
You don't specify your Apache version but since version 2.4, you should Require instead of Allow directives since this is deprecated. See https://httpd.apache.org/docs/2.4/en/howto/access.html
Try adding Listen 80 and Listen 443 to the top of the main config.
Check your httpd.conf. Via the AllowOverride (http://httpd.apache.org/docs/current/mod/core.html#allowoverride) and AllowOverrideList (http://httpd.apache.org/docs/current/mod/core.html#allowoverridelist) directives it can control whether or not .htaccess files are considered.
When this directive (i.e. AllowOverride) is set to None and AllowOverrideList is set to None, .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.
Please note that the default value is None for both, which cause exactly this behavior of not considering .htaccess files.
I am trying to use PHP within my WAMP environment to create new directories (checking if they exists first) on a local drive (U:) which is mapped to a media server (\tr-svrwc-fms)- with no success: I receive a 403 error.
I've tried creating directory Aliases:
Alias /vid "tr-svrwc-fms//"
<Directory "tr-svrwc-fms//">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
and also:
Alias /vid "U:"
<Directory "U:">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow, Deny
Allow from all
</Directory>
I've even tried modifying the root directory settings in httpd.conf to "Allow from all".
my WAMP server version is 2.2 with Apache version 2.2.21
thank you in advance for your help
It is recommended to only use only UNC paths for network resources in httpd.conf
The syntax should look something like this:
Alias /vid "//laptop1/vid"
<Directory "//laptop1/vid">
...
</Directory
Where laptop1 of course will be different in your case.
I've learned that with WAMP installed on my local hard drive, the Apache server (as configured) does not allow for communication outside of the WAMP root folder due to permissions.
This type of communication can however be accomplished via a PHP shell script on the Command Line which doesn't route through the Apache Server.
I know this is a silly question, but I would like to know why it is happening so.
I am using wamp server version 2.1. While viewing directories in localhost, the images beside the files are not getting loaded. Refer image below. On inspect of the image, I see it fails to load /icons/folder.gif, where can I find those images and how to load them?
Step 1, Edit "httpd-autoindex.conf" file like;
Alias /icons/ "C:/wamp/bin/apache/apache2.4.2/icons/"
<Directory "C:/wamp/bin/apache/apache2.4.2/icons">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Step 2, remove first "#" characters from "httpd.conf" file in
Include conf/extra/httpd-autoindex.conf
and
LoadModule autoindex_module modules/mod_autoindex.so
lines
Step 3, restart all services from wamp try icon
it is pointing to wrong dir in
C:\wamp\bin\apache\YOUR_VERSION\conf\extra\httpd-autoindex.conf
Alias /icons/ "/httpd-2.2-x64/icons/"
<Directory "/httpd-2.2-x64/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
should be
Alias /icons/ "icons/"
<Directory "icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
restart server
For whatever reason, you've either removed or moved the icons folder or you've modified a file that points to that folder somewhere on your machine...
The icons folder should reside in: C:\wamp\bin\apache\Apache(version)\
Here are the icons: http://jordanarsenault.com/icons.zip
If they are not already there, put them there.
jsut find the "httpd-autoindex.conf" file from c:\wamp\bin\apache\apache2.4.9\conf\extra folder from apache(your version) folder
find this line "Directives controlling the display of server-generated directory listings".
below this line there will be a address like this "C:/Apache2.2/icons/" (little difference may be there) (2 times)
edit it like this "D:/wamp/bin/apache/apache2.4.9/icons/" (into your directory not the same)
(be careful to use your directory address not the same as above)
it will work...
or check this link and find the answer http://forum.wampserver.com/read.php?2,27544,27861#REPLY
I have installed XAMPP in my machine(Windows XP OS). And I have Eclipse as IDE.
Now my question is, In which directory i should keep my workspace (or project).
Whether I should keep under the path "C:\xampp\php\www" OR under "C:\xampp\htdocs".
You need to change the DocumentRoot value in c:\xampp\apache\conf\httpd.conf from
DocumentRoot "C:\xampp\htdocs"
to
DocumentRoot "E:/MyProject/Source/Admin"
and configure permissions also.
<Directory "E:/MyProject/Source/Admin">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
and then restart the apache server(in xampp control panel). so from there onwards whenever you access http://localhost/ it will execute the files under E:/MyProject/Source/Admin
see for more info.
http://httpd.apache.org/docs/2.0/mod/core.html#documentroot
http://www.apachefriends.org/en/xampp-windows.html#529
Looking at the Where I change the start page? section of XAMP's FAQ (quoting) :
The DocumentRoot folder is
"\xampp\htdocs". There is the
index site (index.php) the real
start page which is loaded after
executing of "http://localhost/".
So, I'd say, in your case, you'll have to work in C:\xampp\htdocs.
Still, of course, you can change that by modifying Apache's configuration and/or creating new VirtualHosts.
in
/Users/username/Sites/somesite/.htaccess
I have
AllowOverride All
php_value include_path ".:/Users/username/Sites/somesite/inludesFolder:/usr/lib/php"
I have also modified
/etc/apache2/httpd.conf
to
AllowOverride All
and restarted websharing, but it's not finding the additional include path. I'd like to avoid modifying the php.ini or setting this additional include path with the PHP
The AllowOverride within the .htaccess file itself isn't legal like that, and might be causing an error that stops further processing. Since the point of AllowOverride is to restrict what .htaccess files can do, it isn't usually useful within an .htaccess file. Try taking it out and see if it works.
Also, rather than modify /etc/apache2/httpd.conf, Mac OS X's configuration is set up so that you drop a file in /etc/apache2/users to configure your own directory. Files in there will persist across system updates and even upgrades!
For example, on my system, the file `/etc/apache2/mark' is:
<Directory "/Users/mark/Sites/">
Options Indexes MultiViews SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>