This is a dedicated thread for discussing the SitePoint article 'Build your own Database Driven Website using PHP & MySQL - Part 1: Installation'
| SitePoint Sponsor |
This is a dedicated thread for discussing the SitePoint article 'Build your own Database Driven Website using PHP & MySQL - Part 1: Installation'
A great tutorial - well explained and thorough. Covers Windows as well as Linux/Mac OS X - something missing on other tutorials.
One word of warning though, there are a few cases where the instructions differ between this article and the PDF file I downloaded (first 4 chapters of the book). I think the PDF file had the correct info, as well as more details.
The article was written in 2001 and served as the starting point for the first edition of the book.
[mmj] My magic jigsaw
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Bit Depth Blog · Twitter · Contact me
Neon Javascript Framework Jokes
Absolute blunder ................ if anyone says that this tutorial is of no use ...
We're in the process of updating the article version of these sample chapters to coincide with the print version and the downloadable PDF.
Last edited by Kevin Yank; Nov 30, 2003 at 23:28.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Very good. Thank you very much for this article.
Real good article. got me started on PHP and MSQL in no time.
Can i get all the chapter remaining for free? ; )
Great. Good details to get you started
Thanks from starting from the beginning. I've used php before but your tutorial filled in a lot of gaps in my understanding of how it works. I look forward to chapter 2!




You're talking about magic_quotes_gpc, right? (3rd edition [the article version], part 1, page 4, "Why should I bother?")Note: PHP experts may tell you that you'll achieve better performance with register_globals set to Off, but that setting exposes you to hackers attempting SQL injection attacks on your Website if you are not very careful to write scripts that protect themselves from such malicious behavior. Until you fully understand PHP and the types of security issues that scripts must combat, leave this setting On.
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Program Files\Apache Group\Apache2\htdocs\today.php on line 2
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Program Files\Apache Group\Apache2\htdocs\today.php on line 2
Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\today.php on line 2
when seting up the root password what about the ERROR 1044: Access denied for user @localhost to database root?
Yep, that's right. It was an error in the adaptation from the book to the article. Fixed now.Originally Posted by Sorccu
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
That error message indicates you have (incorrectly) installed the CGI version of PHP. If you follow the instructions in the article, you will install the module version of PHP, which cannot produce this error message.CGI Error
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Hi...I have the 2nd edition of your excellent book, and have tried to install everything, but PHP does not appear to be working. It's on a Debian/Sarge system. Here is what I've done:
- Installed MySQL 4.1 from tarball. That was successful, can log in at command prompt and do basic DB manipulation.
- Installed Apache2 via apt-get. Also installed apache2-dev as instructed in book.
- Compiled PHP 5 from source following book instructions. In order to make this work I had to install flex, xml2, xml2-dev, gcc and make, all of which I did via apt-get.
Then, still following instructions, I moved php.ini-dist and php.ini-recommended to /usr/local/php/lib and copied php.ini-dist to just plain php.ini
I added in values for doc_root and extension_dir as follows:
doc_root = /var/www
(I also tried /var/www/apache2-default, but still no luck)
extension_dir = "/usr/local/php"
And in the apache2-config file, I changed the DirectoryIndex line to include index.php index.php3 and index.phtml
And added the following two lines to the end:
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
That's all, then I made the sample web page from the book (today.php), and tried to load it from another machine on my network...but it wanted to download the PHP file, which I suppose means the server never tried to render it but just passed it through.
The URL for the PHP file is:
http://sneakypete.is-a-geek.com/apac...ault/today.php
Any suggestions?? I feel like I'm almost there...at least, I hope so!! Can't wait to get cracking on the exercises in the book!
-Pete
Definitely sounds like you're close. Any chance you neglected the 'make install' stage of PHP installation, and only did the 'make'?
Check your Apache 2 config file... does it contain a LoadModule line for the PHP5 shared library (.so) file?
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
WOW that was quick, thanks!!
I do not have such a line in there, no.
This looks familiar - I think I found a similar suggestion on another forum this afternoon and tried it, but can't remember exactly what I did. Whatever it was, I undid it!
Just tried this, which I found on a Gentoo forum. But it gave me an error. I put this line right before the AddType lines near the end of the apache2-config file:
LoadModule php5_module libexec/libphp5.so
and got this error when I tried to restart apache2:
Syntax error on line 398 of /etc/apache2/apache2.conf:
Cannot load /etc/apache2/libexec/libphp5.so into server: /etc/apache2/libexec/libphp5.so: cannot open shared object file: No such file or directory
Yep, it definitely sounds like you missed the 'make install' step. If you look in the book, the build process for PHP is two steps: make and then make install. The first one compiles PHP, the second one copies the libphp5.so file to your Apache module directory and adds the LoadModule line to your apache configuration file.
So I'd suggest getting the PHP5 source package and redoing the compilation step, then making sure you do the 'make install', watching carefully for any errors in this second process.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Okay, can do. I am sure I did both "make" and "make install" - I remember the first gave pages and pages of output, and the second only 20 lines or so. But I must confess I didn't pore over it for errors, I didn't know what to look for.
I am (obviously) a total newbie to compiling from source...this is my first attempt to compile anything! Sorry my questions are so basic, I know this is pretty off-topic.
If I am to go back, is there anything I need to "undo" first? And what step should I start at - do I need to do the configure stuff again?
Many thanks,
Pete
Okay, I tried going back to the tarball, and I found that there were indeed errors of some kind at the "make" stage.
Since I haven't the slightest idea what to do about them, I'm thinking I'm over my head at this point, and maybe should choose something simpler than PHP for my first compile.
So, I used apt-get to install libapache2-mod-php4 and then used the configuration suggestions from your book...and it works!
Since my only goal from this PC at this point is to learn, I expect that's good enough for now, and I'll just use it as is. It would probably take much coaching to get the compile-from-source approach to work.
Thanks for your help though! Got me out of my rut. And if my decision do use the Debian package is a bad one for any reason, feel free to let me know!
-Pete
PHP4 should do just fine for now, yep. If at any stage you decide to re-attempt the compilation, let me know and I should be able to help you nut out the error messages. Usually it's just a package or two you need to apt-get.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
I have a question about numeric data types.
In a different book, it says that "Numeric" and "Decimal" types are interchangeable, and while they are intended for numeric values they "cannot be used for mathematical purposes."
Can anybody shed any light on what this limitation means in practical sense? What is an example of the kind of operation you could perform with a "Float" or "INT" field, but would not be able to do with data in a "Numeric" field?
Bookmarks