SitePoint Sponsor

User Tag List

Page 1 of 5 12345 LastLast
Results 1 to 25 of 119

Hybrid View

  1. #1
    ********* Articles ArticleBot's Avatar
    Join Date
    Apr 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Discussion thread for Build your own Database Driven Website using PHP & MySQL - Part 1: Installatio

    This is a dedicated thread for discussing the SitePoint article 'Build your own Database Driven Website using PHP & MySQL - Part 1: Installation'

  2. #2
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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 · Android stuff

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    CGI Error
    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.
    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

  5. #5
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  7. #7
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!

  8. #8
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  9. #9
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  10. #10
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  11. #11
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  12. #12
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  13. #13
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  14. #14
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    NUMERIC and DECIMAL are indeed two names for the same column type in MySQL. The key purpose of this column type is to allow you to specify the exact number of digits before and after the decimal point, and to be assured of exact precision of the values you store (as opposed to floating point numbers, which suffer from limited precision).

    At least in current MySQL versions, there are no practical limitations on the use of NUMERIC/DECIMAL values in mathematical operations.

    Full documentation on these data types is provided in chapter 11 of the MySQL manual.
    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

  15. #15
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error when restarting IIS

    This is an awesome book. It's exactly what I needed.

    The problem I'm having is that when I restart the World Wide Web Publishing Service as described on page 9 of the book, I get the error message:

    PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_mysql.dll'

    I'm absolutely sure that this file is in the correct place, but it still gives me that. The today.php file later crashes the window spouting some memory access violation and show the text on the screen in numbers. Any advice?
    Last edited by davidleehemphill; Jun 16, 2005 at 15:22.

  16. #16
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by davidleehemphill
    The problem I'm having is that when I restart the World Wide Web Publishing Service as described on page 9 of the book, I get the error message:

    PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_mysql.dll'
    Can you confirm you have copied the file libmysql.dll to your \WINDOWS\SYSTEM32 folder?
    The today.php file later crashes the window spouting some memory access violation and show the text on the screen in numbers. Any advice?
    You're talking about a Windows Blue Screen of Death (BSOD), right? Sounds like a driver or hardware problem unrelated to (but simply being triggered by) PHP and MySQL. If the problem's repeatable, I'd consider a Windows reinstall.
    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

  17. #17
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I can confirm that I have copied the file. And no, it's just an alert box crash with some inetinfo.exe application error. I have uninstalled IIS and reinstalled again using the exact processes you described, but it displays this in the browser instead of "Today's Date (according to this Web server) is":


    -2147467259 (0x80004005)

    Does that help anymore? Thanks for your assistance.

  18. #18
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that link Kevin, that clarifies a lot - I hadn't quite understood the difference between storage range and display width, but it makes perfect sense now. Also, it appears that "decimal" does differ in that it's STORED as characters rather than binary, but it doesn't say anything about that affecting how you can manipulate it. Looks like I misunderstood that too. I'll have to explore that manual in more depth!

    On a different note, I've been unsuccessful at getting a PHP script to connect to a MySQL database. I typed in the example on page 76 of your book (2nd ed) and it's not displaying anything. (By the way the file in the code archive seems incomplete, unless my download somehow got corrupted.) By putting "echo" statements in at various points in the code and observing whether or not the text is displayed, I narrowed it down to the line where it tries to connect:

    $dbcnx = @mysql_connect('localhost', 'root', 'mypassword');

    If I load up the page in a web browser, nothing after that line shows up...not even the HTML that's outside of the PHP tag ("Here are all the jokes in our database.") It just seems to stop.

    From the linux command line, the syntax of 'msql -h localhost -u root -p'
    followed by my password works fine.

    Any idea where else I can look? I've tried some of the things suggested elsewhere in the forums (for instance removing the root password, and fooling with single-, double, and no quotes), but so far no luck!

    -Pete

  19. #19
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It sounds like the MySQL support in your PHP installation isn't working. Remove the error suppression operator (@) from that line and see what error message PHP displays. If it complains that the function mysql_connect doesn't exist, you'll need to reconfigure/recompile PHP with MySQL support enabled.
    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

  20. #20
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes...

    Fatal error: Call to undefined function: mysql_connect() in /var/www/apache2-default/nddpage.php on line 10

    So...will the apt-get installation not work for me? Do I need to go back to the compile-from-source approach?

    In another forum config_doug suggestes turning REGISTER_GLOBALS on, but said that might present a security risk. Seemed easy enough to test so I tried it, and then did 'apache2ctl graceful' but it made no difference.

  21. #21
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland, Oregon, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe a step closer??

    I found a web site
    http://www.projektfarm.com/en/support/debian_setup/
    with instructions for setting up all this stuff on Debian. For one thing, it said to install a bunch of PHP-related packages I didn't have installed. So I did that (all but a couple that I couldn't find.) But, these instructions were for Apache 1.3, and I have Apache 2. I followed the instructions as best I could, making some guesses along the way.

    Now, I get a different error message when trying to load my page:
    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /var/www/apache2-default/nddpage.php on line 10

    On inspection, the file mentioned in the error code (/var/run/mysqld/mysqld.sock) indeed does not exist on my system.

    Seems like progress...but I'm not sure what the next step is!

  22. #22
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yep, you've got MySQL support added to PHP, which is good. Now if you're sure MySQL is running, it sounds like MySQL is set up to accept TCP/IP connections only, not local socket connections.

    I'm afraid I don't know how to solve that one offhand -- worth a trawl through the relevant mailing lists. If you strike out, try installing MySQL manually rather than via apt.
    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

  23. #23
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kevin Yank
    I'm afraid I don't know how to solve that one offhand
    You're a disgrace

  24. #24
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    These chapters are very helpful. So far so good. I have a muddled installation in that there seem to be vestiges of an earlier installation, and have ended up installing 4.1.12 as MySQL41 under Windows services. The command line operations seem to be working properly, so far, having got part way through the joke database.

  25. #25
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you provide any info about the configuration wizard you have to go through?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •