Newt's Linux/Apache/MySQL/PHP (LAMP) FAQ
Posted by: JDS
I often find myself lurking in the various Linux/Apache/MySQL/PHP newsgroups, answering questions (and asking them). The more I lurk, the more I see questions oft repeated. So here is my self-compiled FAQ on those topics.
This is a work in progress, so check back and see what's been added!
Questions
- I want to configure IPTables but don't know how. Help!
- My PHP script gave me the following error: "Parse Error...blah". What does this mean?
- What is the best editor for editing PHP code? (or HTML or Perl or C/C++ etc.)
- What is "Resource Id #2"?
- Why can't I use a variable name I have passed in via the URL? or I had a script that used to work with the variable $value that was passed in via the URL like so: URL?value=123. Why doesn't this work now that I have upgraded to the latest version of PHP?
Answers
I want to configure IPTables but don't know how. Help! Use a freely available Firewall script. For examples, go here: http://www.linuxguruz.com/iptables/or here: http://rocky.molphys.leidenuniv.nl/ (recommended! )
My PHP script gave me the following error: "Parse Error...blah". What does this mean? "Parse Error" = "Syntax Error".
What is the best editor for editing PHP code? (or HTML or Perl or C/C++ etc.)Vi, obviously! Gvim, specifically.
Just my opinion, of course, but beyond reccomending Vim, I have no opinion on other editors. Why Vim? Easy macros, abbreviations, and aliases, Syntactic highlighting, parens finding, multiple cut-and-paste memory registers, easy keyboard-only navigation, small, lightweight memory footprint, and it runs on every computer ever made.
What is "Resource Id #2"? It is a "handle" that PHP uses to access a data resource, such as a file, MySQL query result, or socket. Most often seen in conjunction with MySQL, but may also appear in conjunction with file access, image creation, and others.
If you see an error referring to "Resource ID #xx" as "not a vaild resource" then you have a problem in the code that is supposed create the resource. The most common problems for the mysql_xx functions are incorrect username, password, host, database name, or sql statement. Check those.
Why can't I use a variable name I have passed in via the URL? or...
register_globals must be turned on. Newer versions of PHP have this turned off by default. register_globals allows you to pass variables from script to script via the URL query string.