Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Appache error Forbidden You don't have permission to ... 1

Status
Not open for further replies.

dlamarche

Instructor
Oct 20, 2003
11
CA
Hi everyone. I am new to Apache / PHP / MySQL / phpMyAdmin and stuff but I am having fun.

After installing all of the above and can run with success most of my script except for one type. It seems that all script that have the following code :

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
...
</form>

generate the an error when I click the Submit button:

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

then there is the version of Apache 1.3.34 Server at localhost Port 80.

It is funny that they work fine when run from a folder in my Web server. Only when I run it with localhost that it will have this error. The simple scripts write a record in a MySQL table when I click Submit.

For example if I type :


then fill the blanks and click my Submit button the address becomes:

['PHP_SELF']?>

and the error appears.

Any ideas please because everytime I need to test the script I need to copy the script on the server. I thought that all this setup was suppose to install a PWS in my machine that I could use through
Thank for your time.

D Lamarche
 
Hi

The question belongs to forum434 ( PHP ). It is a PHP setting problem. In your php.ini file the [tt]short_open_tag[/tt] is set to off.

I suggest to forget that syntax and write it as below. This will work everywhere, regardless to the settings.
Code:
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
[gray]...[/gray]
</form>

Feherke.
 
Hi Feherke thank you very much for your tip. I did both set :

short_open_tag is set to true

and use your syntax and it works well now.

Of course you will understand that for a newbie like me knowing where the problem is from is very difficult. Is it from Apache, from PHP maybe a syntax error in my code??

Thank you for guiding me in the right direction.

DLamarche
 
Hi

Oops. There was a copy & paste problem. What I want to suggest is this, to avoid the code's dependecy to settings :
Code:
<form action="<?[red]php[/red] echo $_SERVER['PHP_SELF']; ?>" method="post">
[gray]...[/gray]
</form>
And no problem posting this question here. Without an error message is hard to find out from where comes an error.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top