PDA

View Full Version : Apache Server Configuration



Sualdam
12-29-2003, 08:54 PM
I've just installed Apache (and mySQL and PHP) on my system so I can test PHP files locally.

It works, but I have a problem.

If I create a form with a submit button in it and test it locally, I get the message:

You don't have permission to access /< on this server

If I create a proper form designed to call a PHP script, the message received indicates clearly that the variables from the form are not being passed to the PHP.

The script works fine online - so there are no errors in the code.

I realise that I've not set something in the Apache configuration file, but I've no idea what.

Any ideas, anyone?

mikmik
01-03-2004, 08:18 AM
Hey, Sauldam, I hear you loud and clear. I have all kinds of funky errors on my IIS install of php/cgi.

I was thinking to do this anyways, so I will fir up my apache and see what I can come up with. I am going nuts, well okay I'll live lol, a little with getting denied access as well, but just in Firebird! so I don't know, but I will try to get some ideas back here in the next few days.
Pretty frustrating, eh? I wanted the same thing, of course, bur it is almost like I might as well just test them on remote host for all the trouble!

Sualdam
01-03-2004, 10:03 AM
It's driving me nuts, as well!

I'm sure it must be a simple line missing in the Apache config file(s) or a wrong value assigned to something.

I mean, it's TRYING to do it it but Apache won't let it (localhost) do it.

mikmik
01-06-2004, 03:49 PM
Sauldam, I have been meaning to try this in the past but forgot about it recently:http://www.analogx.com/contents/download/network/phpconf.htm
Description: "PHP is great, but the configuration side of things still leaves a bit to be desired by most Windows users, and that's where AnalogX PHPConfig comes into play!
AnalogX PHPConfig is a graphical frontend to PHP's php.ini file, where all of configuration of PHP takes place. The end result is that you can spend more time on your PHP code and less on tweaking their .ini file. "

I think that now is a good time for me to try it. I don't like going into the .ini file and trying to find 'line 647' etc. and editing in case my syntax is off. I've already edited the wrong line before as well!

And, FYI, these guys make killer software, it is free, clean, and just check out the software, especially the network stuff. One of my favourite sites!

mikmik
01-12-2004, 07:49 PM
Sauldam, did this issue resolve for you yet?
Seems that there are two types of installation procedures, I am just rehashing the setup - I think that I used the '.exe' install.
I have suddenly been getting a "Password Required" page when I try to view my pages with Firebird!

Sualdam
01-12-2004, 07:55 PM
No, I am still testing by uploading.

I downloaded that utility you mentioned and it changed things so that I can now call external PHP files - but variables are not passed from one to the other.

I didn't try very hard, though, because I'm working on some PHP for someone right now and didn't have time.

mikmik
01-12-2004, 08:11 PM
Okay, I think that you are right about the config file in Apache. I will see if I can find something.

<update>
Okay, it seems that Apache is not loading a lib at startup, or most likely you need this in the 'httpd.conf' in the conf folder (apache/conf/httpd.conf)(near the end of sec.1,about 50 lines before 'Section 2: 'Main' server configuration'):
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Please read the file README.DSO in the Apache 1.3 distribution for more
# details about the DSO mechanism and run `apache -l' for the list of already
# built-in (statically linked and thus always available) modules in your Apache
# binary.
#
# Note: The order in which modules are loaded is important. Don't change
# the order below without expert advice.
#
#LoadModule anon_auth_module modules/mod_auth_anon.so
#LoadModule dbm_auth_module modules/mod_auth_dbm.so
#LoadModule digest_auth_module modules/mod_auth_digest.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule digest_module modules/mod_digest.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule speling_module modules/mod_speling.so
LoadModule info_module modules/mod_info.so
LoadModule status_module modules/mod_status.so
#LoadModule usertrack_module modules/mod_usertrack.so
LoadModule php4_module c:/inetpub/php/sapi/php4apache.dll
You also have to add this in the ClearModuleList, just below LoadModule:
#AddModule mod_unique_id.c
AddModule mod_php4.c
AddModule mod_so.c
AddModule mod_setenvif.c

I am installed in IIS in WinXP, so your path might be different. I am really unsure of things in this area, though.

But I have found that the error you refer to, that you are getting, indicates that PHP is not loading.
Other info I found suggests that you may have to re-install Apache.
I just want to give you an indication of what to look for. BY NO MEANS should you take my advise at face value here!
Where is redcircle?! Halp...:o)

mikmik
01-12-2004, 08:58 PM
Here is what I found for Apache documentaion:
http://httpd.apache.org/docs-2.0/

This is probably better than what I got above :
Subject: Apache/PHP Config Problem
http://www.computing.net/linux/wwwboard/forum/23024.html

I think I am going to just re-install mine! lol

USALUG
01-16-2004, 04:20 PM
Do any of these url's work with your server ???

http://localhost or http://127.0.0.1 or http://yourcomputername or
http://yourcomputerslocalipaddress

localhost should open up your "apache test" page.

http://www.thesitewizard.com/archive/php4install.shtml
may be of some help also.

Sualdam
01-16-2004, 04:58 PM
Did you mean mik, me, or both? :)

In my case, both localhost and 127.0.0.1 launch the index page that I have sitting in the target directory (htdocs) I set up when I installed Apache.

It did run the Apache default page when I first installed it.

The behaviour has changed whilst I've been trying a few things.

Initially, as per my original post, PHP pages could not call external PHP files.

After I tinkered with the config file I got it to handle that, but variables are not passed across (i.e. they are null). The same scripts work online.

I'll read through those links - thanks for them, by the way - when I get a chance and let everyone know if I solve anything.

Fingers crossed.

USALUG
01-16-2004, 05:46 PM
both actually :)

Since you had Apache up and running, and assuming php acutally installed.... the above link I provided probably has the answer:


a. Running PHP as an Apache module

To configure Apache to load PHP as a module to parse your PHP scripts, use an ASCII text editor to open the Apache configuration file, "httpd.conf", typically found in "c:\Program Files\Apache Group\Apache\conf\".

Search for the section of the file that has a series of commented out "LoadModule" statements. (Statements prefixed by the hash "#" sign are regarded as having been commented out.) Add the following line after all the LoadModule statements:
LoadModule php4_module "c:/php/php4apache.dll"

If you are using Apache 2.X, remember to use "c:/php/php4apache2.dll" instead of "c:/php/php4apache.dll".

Next, for Apache 1.3.X users, search for the block of "AddModule" statements. Add the following line after the last "AddModule" statement:
AddModule mod_php4.c

Don't worry that you can't find a "mod_php4.c" file anywhere on your system. That directive does not cause Apache to search for the file on your system. For the curious, it specifies the order in which the various modules are enabled by the Apache server.

If you're using Apache 2.X, you do not have to insert the AddModule directive. It's no longer needed in that version. Apache 2.X has its own internal method of determining the correct order of loading the modules.

Finally, search for "AddType" in the file, and add the following line after the last "AddType" statement:
AddType application/x-httpd-php .php

If you need to support other file types, like ".php3" and ".phtml", simply add them to the list, like this:
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml

Makes special note of where the files are for APACHE2 ... as they are NOT the same as previous versions.

HTH's :)

Sualdam
01-16-2004, 06:45 PM
Well, I've tried that and when I tried to start Apache I got the message 'the apache service did not start' and that no error was reported.

I did a bit of trial and error and found that it is the LoadModule bit that stops Apache in this case - comment it out and it fires up.

Then, as you do, I decided to actually think about what I was doing. Although I have PHP installed in the root directory, there is no dll file of the type indicated in that path. And I couldn't find one.

And yet both Apache and PHP work on their own.

I'll read up on those links at the weekend, but thanks for the suggestions so far.

mikmik
01-16-2004, 07:03 PM
Yes, thanks USALUG. I have PHP installed to C:\PHP as well as ~\inetpub\PHP!. I think will check out reinstalling, I want to run IIS and Apache2 on seperate OS's(different partitions) to mirror the hosting providers that I deal with dir. structure. It would be nice to be able to configure/debug scripts on my box and then straight FTP them.
I know enough what to look for now during install.
I will use phpinfo(up there, lol) and imitate!

godzilla
01-19-2004, 07:06 PM
I think that the best Idea in all of your cases is to install PHP Triad(search on google for this).

It is preconfigured, preformated Apache, PHP, Mysql package. It will run just after the install :-).

As for the variable passing check on php.net for setting SuperGlobal variables. Remember that in PHP the variable is passed trough $_POST, $_GET, $_SESSION etc. super global variables. If they are not expressly enabled in the system you will get empty variables when loading forms.

I personally run a server on my own compuetr and do the testing also localy and never had problems with the triade package

I guess this could help...

mikmik
01-20-2004, 09:52 AM
godzilla, you suggest
I think that the best Idea in all of your cases is to install PHP Triad(search on google for this).

That sounds great. Will try it out.

Good point with global variable. I have had to change some scripts before to $_SERVER from something (it was a while ago now) and that sounds like what you are saying. I shall read up and pay attention to globals.
Thanks.

Don't know if that one will help sauldam, though.