Jump to content

WAMP php $_GET issue


OD_php

Recommended Posts

Hi to all, i want to make a question.

I have installed WAMP server etc newer version without seeing the newer version of php, now it has 5.4.3 and as i run the php, the apache server error log states multiple   [WAMP v.2.2 with Apache v.2.4.2, MySQL v.5.5.24 and php v.5.4.3]


AH01630: client denied by server configuration: C:/wamp/www/phpNoobTest.php

 

I suspect that the reason is the $_GET that makes the problem and the data is not written to my SQL database.

Any help/thoughts would be greatly appreciated. Little experience with php unfortunately..

 

That is becouse in the apache server error log it states:

PHP Fatal error:  Directive 'register_globals' is no longer available in PHP in Unknown on line 0

 

 

ALSO I HAVE MADE THIS CHANGE TO PHP.INI:

register_globals = on 

from "off".

 

 

PHP CODE :

<?php
var_dump($_GET);
$val = @$_GET['temperature'];  
if(empty($_GET))
    echo "No GET variables";
else
    print_r($_GET);
//Connect to database
$con = mysql_connect("localhost", "root", "");
if(!$con)
      die('Could not connect: ' .mysql_error());
mysql_select_db("test", $con);

$result = mysql_query("INSERT INTO tempinputs(idinput) VALUES ($val)");
mysql_close($con);
?>
Edited by OD_php
Link to comment
Share on other sites

Adding this:

from the mysql log i got :

130517 19:04:04 [Note] Event Scheduler: Purging the queue. 0 events
130517 19:04:04  InnoDB: Starting shutdown...
130517 19:04:04  InnoDB: Shutdown completed; log sequence number 1937726
130517 19:04:04 [Note] wampmysqld: Shutdown complete

130517 19:04:06 [Note] Plugin 'FEDERATED' is disabled.
130517 19:04:06 InnoDB: The InnoDB memory heap is disabled
130517 19:04:06 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130517 19:04:06 InnoDB: Compressed tables use zlib 1.2.3
130517 19:04:06 InnoDB: Initializing buffer pool, size = 128.0M
130517 19:04:06 InnoDB: Completed initialization of buffer pool
130517 19:04:06 InnoDB: highest supported file format is Barracuda.
130517 19:04:07  InnoDB: Waiting for the background threads to start
130517 19:04:08 InnoDB: 1.1.8 started; log sequence number 1937726
130517 19:04:08 [Note] Server hostname (bind-address): '(null)'; port: 3306
130517 19:04:08 [Note]   - '(null)' resolves to '::';
130517 19:04:08 [Note]   - '(null)' resolves to '0.0.0.0';
130517 19:04:08 [Note] Server socket created on IP: '0.0.0.0'.
130517 19:04:13 [Note] Event Scheduler: Loaded 0 events
130517 19:04:13 [Note] wampmysqld: ready for connections.
Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

Link to comment
Share on other sites

 

 

AH01630: client denied by server configuration: C:/wamp/www/phpNoobTest.php

 

It sounds like the access to web root directory was denied by Apache config.

 

Can you show us the "<DIRECTORY" section describing your web root configuration?

Link to comment
Share on other sites

Thanks a lot for the thoughts and the reply jazzman1 !

(i ll post whatever is needed and requested, but i do think its the change in $_GET in latest php and i know not how to change it)

 

Here are the directory entries in Apache httpd.conf .

 

I have changed it in 2 places to "all granted":

1)

<Directory />
    AllowOverride all
    Require all granted
</Directory>

 

2)

<Files ".ht*">
    Require all granted
</Files>

ServerRoot "c:/wamp/bin/apache/apache2.4.2"
<Directory />
    AllowOverride all
    Require all granted
</Directory>
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride all
    Require all granted
</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.
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.

DocumentRoot "c:/wamp/www/"
<Directory "c:/wamp/www/">
    #
    # 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.4/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 All

    #
    # Controls who can get stuff from this server.
    #
    # Online --> Require all granted
    
    #   onlineoffline tag - don't remove
    
    Require local

</Directory>



#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all granted
</Files>

 

 

Link to comment
Share on other sites

 

 

I did so, but the result was to be unable to load any page of localhost, and as such phpmyadmin etc..

 

That's good something differently happened on the web server that means work ;)

 

Maybe the tilde (~) symbol is treated wrong, try without it.

Link to comment
Share on other sites

Hi there, sorry for the late reply

 

Update and thanks a lot for the help jazzman1! :

Well i did as jazzman said , and the pages load, but still it doesn't write to the database and still the same logs..

Damn, i still think it has something to do with GET..

ps. there is no change so shall i keep it "^\.ht*" or just ".ht*"?

Link to comment
Share on other sites

Use only those:


<Files  "^\.ht">
    Require all granted
</Files>

// or 


<Files  "^\.ht*">
    Require all granted
</Files>

Restart Apache server.

 

When you try to insert some values to the database, did you get some error message?

 

Are you sure that the type of idinput is integer?

Link to comment
Share on other sites

Update as requested with actions:

1) I can insert manually any value in database through phpMyAdmin

2) i have kept the "^\.ht*" version

3) idinput is Float for the database, so i suspect no complications occur

 

4) I do get error messages, as i explained in the beginning: 

- The message "PHP Fatal error:  Directive 'register_globals' is no longer available in PHP in Unknown on line 0" , which i eliminated without knowing if it solves anything by commenting out the "register_globals on" line , the only reference in php.ini found on those, as $_GET is a register global.

 

- The tons of messages ".... AH01630: client denied by server configuration: C:/wamp/www/phpNoobTest.php" which is the beginning of the thread to solve my issue.

Link to comment
Share on other sites

heehehe of course, although i have solved my problem in another way, i ll explain right after the quote:

.htaccess(i thought there was only one, are there more?):

Order allow,deny

I would love it if we could solve the problem tho! Might help others and will help me understand better the whole thing. Now that i can continue my work, its not time pressing :)

Jazzman1 i do thank you deeply for all the help till now and the time spent!

 

 

The way i solved my problem is like that:

 

I have WAMP server 2.2, meaning Apache 2.4.2 , php 5.4.3 and MySQL 5.5.24 .

I installed these addons (other previous instances of WAMP Apache and php from WAMP official site, similar to what i had before i changed to the newer version of WAMP [i don't recall the previous version dammit]) :

So now i got running in harmony Apache 2.2.14, php 5.3.1 and same MySQL.

I made the Allow, Deny changes etc, as well as register_globals on as before.

Because phpMyAdmin can't be changed [version 3.5.1] as the other elements can in WAMP, i checked and in c:\alias\phpmyadmin.conf , the "require local" has been commented out and in it's place

Order Deny,Allow
Deny from all
Allow from all

[i think the next line overwrites the previous, so Allow from all is what remains from his previous Deny from all, but i kept it just for the rock of it]

Link to comment
Share on other sites

This topic is considered semi-closed, as i have found the "solution" , meaning the way to continue with my project, but the core of the post, the problem with GET in newer PHP versions with MySQL, in other words, as i assume, HOW TO CHANGE GET FUNCTIONS in WAMP, is still unanswered, despite all the patience of mr.Jazzman :)

So i can't really edit the topic closed, its up to the admins or someone who wants to continue with the solution to label the thread in time.

 

See you soon!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.