davidm.me Posted September 6, 2011 Share Posted September 6, 2011 Hi I have some php webpages that where working OK. Now this error has suddenly appeared: Notice: Undefined index. REQUEST_URI in menu.php on line 4 Here are the first 6 lines from menu.php: <div style="float: left; width: 150px; margin-left: 0; padding-left: 0;"> <ul style="margin-left: 0; padding-left: 0; color: white;"> <li class="accordionButton style="color: red;"<?php if (basename($_SERVER["REQUEST_URI"]) == "index.php") { echo " active_link"; } ?>"> <a class="rfpMenuBtn" style="color: grey;font-size: 11pt;" href="index.php">Home</a></li> Also when I click on a link from the above menu.php the php include files for the link are not parsed only the html in the actual file that I link to appears nothing from the php include files. I've recently tried to do some cleaning up on my pc in the process I ran "Free Windows Registry Repair 2.5" and SpeedUpMyPC 2011. I don't know if one of these caused the problem. My OS is Windows XP I've installed xampp with php for windows. I'm using HTML-Kit to write php pages. Another change I've noticed is that before the clean up, to preview pages in HTML-Kit I would first have to run: iisreset -stop , then start Apache from xampp control panel. Now the preview works with and without running iisreset and starting Apache. Some-one from another forum suggested I run print_r($_SERVER) this is the output I received: Array ( [ALLUSERSPROFILE] => C:\Documents and Settings\All Users.WINDOWS [APPDATA] => C:\Documents and Settings\davidm.DAVID\Application Data [CLASSPATH] => .;C:\Program Files\QuickTime\QTSystem\QTJava.zip [CommonProgramFiles] => C:\Program Files\Common Files [COMPUTERNAME] => DAVID [ComSpec] => C:\WINDOWS\system32\cmd.exe [FP_NO_HOST_CHECK] => NO [HOMEDRIVE] => C: [HOMEPATH] => \Documents and Settings\davidm.DAVID [iNCLUDE] => d:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\ [LIB] => d:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\ [LOGONSERVER] => \\DAVID [NUMBER_OF_PROCESSORS] => 2 [OS] => Windows_NT [Path] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\:\Program Files\Samsung\Samsung PC Studio 3 [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH [PROCESSOR_ARCHITECTURE] => x86 [PROCESSOR_IDENTIFIER] => x86 Family 6 Model 23 Stepping 6, GenuineIntel [PROCESSOR_LEVEL] => 6 [PROCESSOR_REVISION] => 1706 [ProgramFiles] => C:\Program Files [QTJAVA] => C:\Program Files\QuickTime\QTSystem\QTJava.zip [sESSIONNAME] => Console [systemDrive] => C: [systemRoot] => C:\WINDOWS [TEMP] => C:\DOCUME~1\DAVIDM~1.DAV\LOCALS~1\Temp [TMP] => C:\DOCUME~1\DAVIDM~1.DAV\LOCALS~1\Temp [uSERDOMAIN] => DAVID [uSERNAME] => davidm [uSERPROFILE] => C:\Documents and Settings\davidm.DAVID [VS71COMNTOOLS] => d:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\ [VS90COMNTOOLS] => d:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\ [windir] => C:\WINDOWS [__COMPAT_LAYER] => EnableNXShowUI [php_SELF] => [REQUEST_TIME] => 1315219257 ) PHP Notice: Undefined index: REQUEST_URI in menu.php on line 14 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 19 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 24 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 29 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 34 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 39 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 45 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 50 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 55 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 60 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 65 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 70 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 75 PHP Notice: Undefined index: REQUEST_URI in menu.php on line 81 This is all Chinese to me and I'm English. I'm a complete php novice. Any help greatly appreciated. Thanks David Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/ Share on other sites More sharing options...
AyKay47 Posted September 6, 2011 Share Posted September 6, 2011 looks like your server has the REQUEST_URI index omitted.. Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1265973 Share on other sites More sharing options...
davidm.me Posted September 6, 2011 Author Share Posted September 6, 2011 Thanks for the reply My server? that would be Apache i assume. Or is it now IIS? How do I know which server and how can I change it back? Why would REQUEST_URI suddenly disappear? and what do I need to do to get it back again.? Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1266005 Share on other sites More sharing options...
premiso Posted September 6, 2011 Share Posted September 6, 2011 My server? that would be Apache i assume. Or is it now IIS? How do I know which server and how can I change it back? Why would REQUEST_URI suddenly disappear? and what do I need to do to get it back again.? Your server is now IIS. As far as REQUEST_URI not being there, IIS probably omits it while apache gives it out. And googling confirmed that. You can see a hack of a fix here: http://davidwalsh.name/iis-php-server-request_uri which basically has this code for the fix: if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],1 ); if (isset($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']; } } To find more information this is what I googled: http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=IIS+Request_URI Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1266008 Share on other sites More sharing options...
davidm.me Posted September 6, 2011 Author Share Posted September 6, 2011 Premiso Thanks for all the info, I think your correct. The question is how do I specify which server is used? Or how do I stop IIS? I've tried net stop w3svc and iisreset -stop but it makes no difference, so I obviously don't understand how and when IIS works or not. Please could someone tell me how I use the Apache server and not IIS. Thanks very much David Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1266091 Share on other sites More sharing options...
davidm.me Posted September 7, 2011 Author Share Posted September 7, 2011 In addition to the above problem with REQUEST_URI if I click on any of the links in the menu I get the linked page without any of the of the php being parsed. If I try view source I see: <?php include ("include/head-section.php"); include ("include/collapse_expand_div.php"); ?> </head> instead of the parsed content. I've stopped and disabled IIS Admin and XAMPP Apache is running. Can someone explain to me why my php files are suddenly not being parsed and what I need to do to get the php file content included in my webpages - this was all working fine last week before my clean up. Would reinstalling help? I don't really want to go there, 'cause it took me quite a while to get all the configuration and .ini files setup correctly, but if Idon't have any choice then maybe someone can point me to to some good documentation for reinstalling php Thanks for any help - I really need it. David "paddling upstream searching for the source" Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1266330 Share on other sites More sharing options...
davidm.me Posted September 7, 2011 Author Share Posted September 7, 2011 PROGRESS! As I said at the beginning all these problems started after running Free Windows Registry Repair 2.5 This utility has an option to restore the registry, so that should have been the first thing I should have done, right? Well I just did it now and all my problems have disappeared everything is as it was before the clean up. If it aint broken don't fix it! Thanks for all your help David "Paddling upstream searching for the source" Quote Link to comment https://forums.phpfreaks.com/topic/246547-notice-undefined-index-request_uri/#findComment-1266334 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.