Jump to content


Photo

WAMP php $_GET issue


  • Please log in to reply
12 replies to this topic

#1 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 17 May 2013 - 10:55 AM

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, 17 May 2013 - 11:06 AM.


#2 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 17 May 2013 - 11:12 AM

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)



#3 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,678 posts
  • LocationMississauga, Canada

Posted 18 May 2013 - 10:55 AM

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?



#4 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 18 May 2013 - 02:39 PM

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>

 

 



#5 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,678 posts
  • LocationMississauga, Canada

Posted 18 May 2013 - 06:10 PM

Change:

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

// to

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

Don't forget to restat Apache.



#6 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 19 May 2013 - 04:06 AM

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



#7 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,678 posts
  • LocationMississauga, Canada

Posted 19 May 2013 - 07:49 AM

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.



#8 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 19 May 2013 - 04:17 PM

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*"?



#9 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,678 posts
  • LocationMississauga, Canada

Posted 19 May 2013 - 05:56 PM

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?



#10 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 20 May 2013 - 06:23 AM

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.



#11 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,678 posts
  • LocationMississauga, Canada

Posted 20 May 2013 - 10:42 AM

It's time to show us every hidden .htaccess files on this project ;)



#12 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 20 May 2013 - 04:50 PM

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]



#13 OD_php

OD_php

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 23 May 2013 - 05:03 AM

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!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com