ProgMan Posted July 9, 2018 Share Posted July 9, 2018 Hi Larry As a newbie to php and web development (I am a bit 'old school' coming from a desktop/Windows background) and I am working through Edition 5 of your excellent book and have hit an early snag.... I am running everything locally on my laptop using Wampserver 3.1.3 which I believe is configured correctly as it runs other code successfully and pushes it out to IE and Chrome without any problem. Chapter 1 contains the $_SERVER variable exercise which, on the face of it shouldn't pose any issues - but I am struggling to understand what is going on with my particular set up. Basically, I am getting a null return from all the 3 server variable that you list in the exercise (the code initially failed with an invalid index error that I was able to resolve with the isset() function). When I do a phpinfo() check from within a php code snippet it suggests that these variables are not available (and all _SERVER variables are missing the leading $), whereas if I run phpinfo() directly from the link on the Wampserver homepage a much more comprehensive list of variables is displayed. Whilst this issue is clearly not a showstopper it highlights a fundamental learning issue that I need to understand if I am to code with confidence in php. Can you help please? Many thanks Link to comment Share on other sites More sharing options...
chuflasky Posted July 12, 2018 Share Posted July 12, 2018 Hi ProgMan, can you post your code so a least we can see on your end if you doing something wrong. And did you check the WAMPSERVER is running correctly when testing your code. Link to comment Share on other sites More sharing options...
Larry Posted July 15, 2018 Share Posted July 15, 2018 Thanks for the nice words! This is really strange. According to the PHP manual: Quote There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. I looked around and don't see any obvious causes and solutions to this, not even specific to Wampserver. Just to be certain, are you running the script through HTTP? Link to comment Share on other sites More sharing options...
Recommended Posts