This is a discussion on php_self-- works on the server, but not locally php/apache setup issue? within the Apache Web Server forums, part of the Web Server and Related Forums category; Have the following configuration. php 5.2.0 apache 2.2.4 The following submission, before I did a major ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Have the following configuration.
php 5.2.0 apache 2.2.4 The following submission, before I did a major upgrade back in February, worked fine with localhost, and will still work fine in a server enviornment,anything from jatol, to godaddy. ..... <form name='fmSubmittal' method='post' action="<?php $_SERVER['PHP_SELF']; ?>"> <table border='3'> <tr><td colspan='4' align='center'><button type='submit' value='SUBMIT' name='sub1'>SUBMIT</button><button type='reset' value='reset' name='res'>Reset</button></tr> if (isset($sub1)) { //$CommA is the submit button session_register('chosen'); include 'autunite/dConn.php'; include 'autunite/Ser.php'; $szInterests=sizeOf($Int); echo "# of interests is, $szInterests or sizeOf($Int)"; ..... BUT, when developing on my local machine (localhost), I get the following message when submitting a form, using the variable action above. $_SERVER['PHP_SELF'] Forbidden You don't have permission to access /dt/< on this server. Starting with "?php... " makes the Forbidden error go away, but doesn't process the form. (yes, I included some of the variables in session_register). The series of code, however, processes. Not even that echo, echoes like it is supposed to. putting <?= in front results in the same FORBIDDEN error, with the http line reading, http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E Is there a change in either the httpd file or php.ini, I'm missing? It worked fine before the overhaul, and might of, even after it. Everything works, as expected, on the server side. But don't want to upload small changes every time to see if it works, lol. any ideas???? |
|
|||
|
On 23 Apr, 19:59, G...@steric.net wrote:
> Have the following configuration. > php 5.2.0 > apache 2.2.4 > > The following submission, before I did a major upgrade back in > February, worked fine with localhost, > and will still work fine in a server enviornment,anything from jatol, > to godaddy. > > .... > <form name='fmSubmittal' method='post' action="<?php > $_SERVER['PHP_SELF']; ?>"> > <table border='3'> > > <tr><td colspan='4' align='center'><button type='submit' > value='SUBMIT' name='sub1'>SUBMIT</button><button type='reset' > value='reset' name='res'>Reset</button></tr> > > if (isset($sub1)) { //$CommA is the submit button > session_register('chosen'); > include 'autunite/dConn.php'; > include 'autunite/Ser.php'; > $szInterests=sizeOf($Int); > echo "# of interests is, $szInterests or sizeOf($Int)"; > > .... > > BUT, when developing on my local machine (localhost), I get the > following message when submitting a form, using the variable action > above. $_SERVER['PHP_SELF'] > > Forbidden > You don't have permission to access /dt/< on this server. > > Starting with "?php... " makes the Forbidden error go away, but > doesn't process the form. (yes, I included some of the variables in > session_register). The series of code, however, processes. Not even > that echo, echoes like it is supposed to. > > putting <?= in front results in the same FORBIDDEN error, with the > http line reading,http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E > > Is there a change in either the httpd file or php.ini, I'm missing? > It worked fine before the overhaul, and might of, even after it. > > Everything works, as expected, on the server side. But don't want to > upload small changes every time to see if it works, lol. > > any ideas???? do you mean action="<?php echo $_SERVER['PHP_SELF']; ?>" whereas you have action="<?php $_SERVER['PHP_SELF']; ?>" which doesnt print anything, and so there tried to post back to whatever the URL is which in your case is /dk/ - your localhost is set up not to use index.php - add directoryindex index.php to your conf file, so it tries presumably to post to the default page which doesnt exist, index.htm/l? anyway you cant use short tags in this version of php (well shouldnt ) and its probably disabled by default, get away from <?= if you can instead always use <?php echo instead to future proof your code. |
|
|||
|
On Apr 23, 9:28 pm, shimmyshack <matt.fa...@gmail.com> wrote:
> On 23 Apr, 19:59, G...@steric.net wrote: > > > > > Have the following configuration. > > php 5.2.0 > >apache2.2.4 > > > The following submission, before I did a major upgrade back in > > February, worked fine with localhost, > > and will still work fine in a server enviornment,anything from jatol, > > to godaddy. > > > .... > > <form name='fmSubmittal' method='post' action="<?php > > $_SERVER['PHP_SELF']; ?>"> > > <table border='3'> > > > <tr><td colspan='4' align='center'><button type='submit' > > value='SUBMIT' name='sub1'>SUBMIT</button><button type='reset' > > value='reset' name='res'>Reset</button></tr> > > > if (isset($sub1)) { //$CommA is the submit button > > session_register('chosen'); > > include 'autunite/dConn.php'; > > include 'autunite/Ser.php'; > > $szInterests=sizeOf($Int); > > echo "# of interests is, $szInterests or sizeOf($Int)"; > > > .... > > > BUT, when developing on my local machine (localhost), I get the > > following message when submitting a form, using the variable action > > above. $_SERVER['PHP_SELF'] > > > Forbidden > > You don't have permission to access /dt/< on this server. > > > Starting with "?php... " makes the Forbidden error go away, but > > doesn't process the form. (yes, I included some of the variables in > > session_register). The series of code, however, processes. Not even > > that echo, echoes like it is supposed to. > > > putting <?= in front results in the same FORBIDDEN error, with the > > http line reading,http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E > > > Is there a change in either the httpd file or php.ini, I'm missing? > > It worked fine before the overhaul, and might of, even after it. > > > Everything works, as expected, on the server side. But don't want to > > upload small changes every time to see if it works, lol. > > > any ideas???? > > do you mean > action="<?php echo $_SERVER['PHP_SELF']; ?>" > whereas you have > action="<?php $_SERVER['PHP_SELF']; ?>" > which doesnt print anything, and so there tried to post back to > whatever the URL is which in your case is /dk/ - your localhost is set > up not to use index.php - add > directoryindex index.php > to your conf file, so it tries presumably to post to the default page > which doesnt exist, index.htm/l? Actually, in the httpd.conf file, in <IfModule dir_module>, the directoryIndex exists, but had it in the order of index.html index.php index.htm </IfModule> I have changed the order of the index files to see if that makes a difference, though, if it does, I'd have a problem, if I was using index.htm/l, which I don't :o) I'm also not using index.php to do this process. It is called, cu.php. Just calls the code upon a submit button. Tested--- no difference. Also, localhost takes forever to process the page in Firefox while on the server, it doesn't take any time at all. It processes a portion, then sits, then finishes, without displaying the text i want it to. In fact, the isset($sub1) doesn't seem to register at the press of a button which I assigned a name of, 'sub1'. Works fine on the server. (I have an if statement If (isset($sub1)) { linked to the submit button push, and it fires on the server side, but not on the localhost side-- Could it be a configuration setting or something different about my new combination of Apache Mysql Php that I don't know about ????? > > anyway you cant use short tags in this version of php (well shouldnt ) > and its probably disabled by default, get away from <?= if you can > instead always use <?php echo instead to future proof your code. I do usually front with <?php...?> Has <?= gone away with a certain version?? If so, I might have to change some old code. thanks |
|
|||
|
On Apr 24, 8:31 pm, G...@steric.net wrote:
> On Apr 23, 9:28 pm, shimmyshack <matt.fa...@gmail.com> wrote: > > > > > On 23 Apr, 19:59, G...@steric.net wrote: > > > > Have the following configuration. > > > php 5.2.0 > > >apache2.2.4 > > > > The following submission, before I did a major upgrade back in > > > February, worked fine with localhost, > > > and will still work fine in a server enviornment,anything from jatol, > > > to godaddy. > > > > .... > > > <form name='fmSubmittal' method='post' action="<?php > > > $_SERVER['PHP_SELF']; ?>"> > > > <table border='3'> > > > > <tr><td colspan='4' align='center'><button type='submit' > > > value='SUBMIT' name='sub1'>SUBMIT</button><button type='reset' > > > value='reset' name='res'>Reset</button></tr> > > > > if (isset($sub1)) { //$CommA is the submit button > > > session_register('chosen'); > > > include 'autunite/dConn.php'; > > > include 'autunite/Ser.php'; > > > $szInterests=sizeOf($Int); > > > echo "# of interests is, $szInterests or sizeOf($Int)"; > > > > .... > > > > BUT, when developing on my local machine (localhost), I get the > > > following message when submitting a form, using the variable action > > > above. $_SERVER['PHP_SELF'] > > > > Forbidden > > > You don't have permission to access /dt/< on this server. > > > > Starting with "?php... " makes the Forbidden error go away, but > > > doesn't process the form. (yes, I included some of the variables in > > > session_register). The series of code, however, processes. Not even > > > that echo, echoes like it is supposed to. > > > > putting <?= in front results in the same FORBIDDEN error, with the > > > http line reading,http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E > > > > Is there a change in either the httpd file or php.ini, I'm missing? > > > It worked fine before the overhaul, and might of, even after it. > > > > Everything works, as expected, on the server side. But don't want to > > > upload small changes every time to see if it works, lol. > > > > any ideas???? > > > do you mean > > action="<?php echo $_SERVER['PHP_SELF']; ?>" > > whereas you have > > action="<?php $_SERVER['PHP_SELF']; ?>" > > which doesnt print anything, and so there tried to post back to > > whatever the URL is which in your case is /dk/ - your localhost is set > > up not to use index.php - add > > directoryindex index.php > > to your conf file, so it tries presumably to post to the default page > > which doesnt exist, index.htm/l? > > Actually, in the httpd.conf file, in > <IfModule dir_module>, the directoryIndex exists, but had it in the > order of > index.html index.php index.htm </IfModule> > > I have changed the order of the index files to see if that makes a > difference, though, if it does, > I'd have a problem, if I was using index.htm/l, which I don't :o) > I'm also not using index.php to do this process. It is called, > cu.php. Just calls the code upon a submit button. > > Tested--- no difference. Also, localhost takes forever to process > the page in Firefox while on the server, it doesn't take any time at > all. > It processes a portion, then sits, then finishes, without displaying > the text i want it to. In fact, the isset($sub1) doesn't seem to > register at the press of a button which I assigned a name of, 'sub1'. > > Works fine on the server. > (I have an if statement If (isset($sub1)) { linked to the submit > button push, and it fires on the server side, but not on the localhost > side-- > Could it be a configuration setting or something different about my > new combination of Apache Mysql Php that I don't know about ????? > > > > > anyway you cant use short tags in this version of php (well shouldnt ) > > and its probably disabled by default, get away from <?= if you can > > instead always use <?php echo instead to future proof your code. > > I do usually front with <?php...?> Has <?= gone away with a > certain version?? If so, I might have to change some old code. > > thanks there are a few things that are different, you can use <?=$var;?> but dont, instead use <?php echo $var ?> this avoids conflicts with xml headers if you start to use them, so in fact once all your code hsa been adjusted you could finally turn off short tags in the php.ini for good measure. It seems as if short tags has gone with your version, which is why you get http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E when you try to use <?$_SERVER['PHP_SELF'] so do a search and replace and change them all over from <?= to <?php echo and you're done. (It still surprises me how much major opensource code is still written with this shortcut) globals has gone for security reasons, so you cannot use <form> <input name="blah_var" type="text/> <input name="blah_submit" type=-"submit"/> </form> <?php if( isset($blah_var, $blah_submit) ) { echo $blah_var; echo $blah_submit; } ?> you must instead use <?php if ( isset($_POST['blah_var'], $_POST['blah_submit']) ) { echo $_POST['blah_var']; echo $_POST['blah_submit']; } ?> you could also use $_REQUEST['blah_var'], but that is to be avoided and you know you used POST anyway. from what you said about directoryIndex, things are fine, the order doesnt matter, only the existence of a page that you could post to, without specifying in the action. According to xhtml standards the action cannot be left empty although in practise its not a problem as browsers just submit to the URL they are already on. Using <?php $_SERVER['PHP_SELF'] ?> which doesnt echo anything, would have resulted in the browser trying to POST to the URL it was already on, which appeared to be the default for that /dk/ directory. I was interested in the forbidden error, have you tried to use a LIMIT statement to ban the verb types that can be used on your version of apache? Some people often use LIMIT where they actually mean LimitExcept although in your case that might not apply as you can clearly GET the page. Once you modernise the php code I wonder if your page will work, if you are using XP there are a couple of specific issues windows sometimes has that might cause a hang, but Im not convinced your script is hanging, more just not processing. |
|
|||
|
On Apr 24, 8:31 pm, G...@steric.net wrote:
> On Apr 23, 9:28 pm, shimmyshack <matt.fa...@gmail.com> wrote: > > > > > On 23 Apr, 19:59, G...@steric.net wrote: > > > > Have the following configuration. > > > php 5.2.0 > > >apache2.2.4 > > > > The following submission, before I did a major upgrade back in > > > February, worked fine with localhost, > > > and will still work fine in a server enviornment,anything from jatol, > > > to godaddy. > > > > .... > > > <form name='fmSubmittal' method='post' action="<?php > > > $_SERVER['PHP_SELF']; ?>"> > > > <table border='3'> > > > > <tr><td colspan='4' align='center'><button type='submit' > > > value='SUBMIT' name='sub1'>SUBMIT</button><button type='reset' > > > value='reset' name='res'>Reset</button></tr> > > > > if (isset($sub1)) { //$CommA is the submit button > > > session_register('chosen'); > > > include 'autunite/dConn.php'; > > > include 'autunite/Ser.php'; > > > $szInterests=sizeOf($Int); > > > echo "# of interests is, $szInterests or sizeOf($Int)"; > > > > .... > > > > BUT, when developing on my local machine (localhost), I get the > > > following message when submitting a form, using the variable action > > > above. $_SERVER['PHP_SELF'] > > > > Forbidden > > > You don't have permission to access /dt/< on this server. > > > > Starting with "?php... " makes the Forbidden error go away, but > > > doesn't process the form. (yes, I included some of the variables in > > > session_register). The series of code, however, processes. Not even > > > that echo, echoes like it is supposed to. > > > > putting <?= in front results in the same FORBIDDEN error, with the > > > http line reading,http://localhost/dt/%3C?=$_SERVER['PHP_SELF'];%20?%3E > > > > Is there a change in either the httpd file or php.ini, I'm missing? > > > It worked fine before the overhaul, and might of, even after it. > > > > Everything works, as expected, on the server side. But don't want to > > > upload small changes every time to see if it works, lol. > > > > any ideas???? > > > do you mean > > action="<?php echo $_SERVER['PHP_SELF']; ?>" > > whereas you have > > action="<?php $_SERVER['PHP_SELF']; ?>" > > which doesnt print anything, and so there tried to post back to > > whatever the URL is which in your case is /dk/ - your localhost is set > > up not to use index.php - add > > directoryindex index.php > > to your conf file, so it tries presumably to post to the default page > > which doesnt exist, index.htm/l? > > Actually, in the httpd.conf file, in > <IfModule dir_module>, the directoryIndex exists, but had it in the > order of > index.html index.php index.htm </IfModule> > > I have changed the order of the index files to see if that makes a > difference, though, if it does, > I'd have a problem, if I was using index.htm/l, which I don't :o) > I'm also not using index.php to do this process. It is called, > cu.php. Just calls the code upon a submit button. > > Tested--- no difference. Also, localhost takes forever to process > the page in Firefox while on the server, it doesn't take any time at > all. > It processes a portion, then sits, then finishes, without displaying > the text i want it to. In fact, the isset($sub1) doesn't seem to > register at the press of a button which I assigned a name of, 'sub1'. > > Works fine on the server. > (I have an if statement If (isset($sub1)) { linked to the submit > button push, and it fires on the server side, but not on the localhost > side-- > Could it be a configuration setting or something different about my > new combination of Apache Mysql Php that I don't know about ????? > > > > > anyway you cant use short tags in this version of php (well shouldnt ) > > and its probably disabled by default, get away from <?= if you can > > instead always use <?php echo instead to future proof your code. > > I do usually front with <?php...?> Has <?= gone away with a > certain version?? If so, I might have to change some old code. > > thanks apologies if this posts twice, my last post doesnt seem to have appeared. change all <?= to <?php echo order of arguments for directoryindex doesnt matter, so youre fine there. globals is now defunct so use $_POST['var'] rather than $var when using forms with <input name="var" type="text"/> ..... if you are on windows, check the apache website for specific directives that might need to be enabled if your server appears to hang sometimes: Win32DisableAcceptEx etc... you appear to have moved from php4 to 5, i recommend checking the php website for all changes and best practise, sessions etc... while you are at it, review security on your scripts to avoid XSS, mail and sql injection and other nasties. |