Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 13th, 2003, 06:17 PM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default php/mysql programming problem - design - solution

Hi,

I'm really stuck and have absolutely NO idea why nothing's working. I've downloaded the source files and uncompressed the zip, stuck it in my webserver folder, put the correct things in the config.php file, added a .htaccess (which I think I've got correct!) file in the root dir of the site, run all the sql files using phpmyadmin, then, when I try to access the site, all I ever get is a blank page!!! any ideas what it could be ???

// here's my config.php file:
Code:
<?php

// File Location: /_lib/_base/config.php

/** 
 * Assign configuration variables
 *
 * @author Mike Buzzard <src@cubancouncil.com>
 * @version 1.0
 * @since 1.0
 * @access public
 * @copyright Cuban Council
 *
 */

/* set version number */
define("VERSION", "1.0");                                            // apps version

/* assign php configuration variables */
ini_set("track_errors", "1");                                          // error tracking

/* assign base system constants */
define("SITE_URL", "http://127.0.0.1/wrox_site/");     // base site url
define("SITE_DIR", "/");                                               // base site directory
define("BASE_DIR", $_SERVER["DOCUMENT_ROOT"]);  // base file directory
define("SELF", $_SERVER["PHP_SELF"]);                        // self file directive
define("FILEMAX", 1500000);                                     // file size max

/* assign base database constants */
define("PREFIX", "wrox");                                            // database table prefix
define("TIMEOUT", 3600);                                          // timeout (seconds)
define("ROWCOUNT", 10);                                          // rows to show per page
define("DSN", "mysql://root:******@localhost/wrox");// DSN for PEAR usage

/* assign base mail constants */
define("SMTP_HOST", "localhost");                      // SMTP hostname
define("SMTP_PORT","25");                              // SMTP port default=25
define("FROM_NAME","DVD Life");                        // newsletter from name
define("FROM_EMAIL","jon@jben.net");      // newsletter from email

/* assign base entity constants */
define("TITLE", "DVDLife.com");                        // base page title
define("ENTITY", "DVD Life");                          // entity name
define("EMAIL", "jon@jben.net");               // admin email

/* assign instance variables */
$EXCEPTS = array();                                    // exceptions array
$ERRORS = array();                                     // errors array
$FILES = array("jpg", "gif", "png");                   // file types array
$FORMOK = true;                                       // form status

set_magic_quotes_runtime(1);                           // magic quotes on

?>
I'm running php 4.3.3 so I don't need to install PEAR. I know mysql is fine, god I'm at a complete loss, someone help please !!!!!!!

Thanks,

Jon
Reply With Quote
  #2 (permalink)  
Old November 13th, 2003, 10:53 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

WHat script are you running? If you're only accessing that config.php script in the browser, you won't see anything in the browser because you're not outputting anything in the script.

I guess I'm a little confused as to what you're trying to do. What book are you talking about? And (as we are discussing in a separate thread) you DO need to ensure that PHP's include path knows where the PEAR php files are.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old November 13th, 2003, 10:55 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also -- you should set error_reporting = E_ALL in php.ini -- that might cause your script to generate warnings and/or errors that were previously suppressed.

Keep in mind that suppressed errors are still errors, you just don't know about them because PHP isn't telling you.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #4 (permalink)  
Old November 14th, 2003, 11:03 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I think I've tracked down the problem, it lies with my include_path in my .htaccess file.

If I load a php file and use explicit file paths rather than just the file name I don't get any errors, but if I try just using the name I get nothing ???

// php
Code:
<?php

// File Location: /test.php

// works
require_once("./_lib/_base/config.php");

//  doesn't work
//require_once("config.php"); 

// using full path all loads of stuff outputed, without nothing
print_r(get_defined_constants());

?>
My .htaccess file is like this:

// .htaccess
Code:
php_value include_path ".:/usr/local/php/lib/php/:/Library/WebServer/Documents/wrox_site/_lib/_base/:/Library/WebServer/Documents/wrox_site/_lib/_classes/:/Library/WebServer/Documents/wrox_site/site/:/usr/local/php/lib/php/PEAR/"

php_value register_globals "off"
Any ideas ??????

Thanks,

Jon
Reply With Quote
  #5 (permalink)  
Old November 14th, 2003, 01:11 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you haven't configured apache to allow .htaccess files to override config settings, then anything you change in .htaccess will be ignored. Make sure you have AllowOverride Options (or All) set for that directory in apache's httpd.conf.

Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #6 (permalink)  
Old November 14th, 2003, 01:54 PM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Nik,

I've just tried changing my httpd.conf file so that AllowOverride All rather than None (which is how it was set before) but as soon as I change it, restart apache and every php file I try to access get's a internal 500, god, I really don't know why this is sooooo difficult!

Give me a few mins (only just got back in) and I'll start over on what I'm trying to accomplish!

Thanks for all your time :-)

Jon
Reply With Quote
  #7 (permalink)  
Old November 14th, 2003, 02:08 PM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

woo hoo!!! got it! because pico was wrapping the line with the php_value include_path on it when I saved, when I added AllowOveride All in the httpd.conf file it caused apache to error, it's all working (ish) now. Don't know why I didn't think about checking the apache logs sooner!!!!!

Thanks,

Jon
Reply With Quote
  #8 (permalink)  
Old November 14th, 2003, 07:57 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Glad it's working!

Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #9 (permalink)  
Old November 14th, 2003, 09:00 PM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for all your help man, couldn't've done it without you!!

jon
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows based Problem Design Solution Book ricpue BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 September 1st, 2006 07:47 AM
php-mysql website - problem design solution pannet1 Pro PHP 0 December 23rd, 2005 01:49 PM
php/mysql programming problem - design - solution jben.net Beginning PHP 23 November 20th, 2003 06:34 PM
PHP MySQL Website Programming P-D-S robmorrish All Other Wrox Books 1 August 5th, 2003 01:29 AM
Building a PHP Intranet Problem-Design-Solution kseba All Other Wrox Books 0 June 23rd, 2003 04:26 PM



All times are GMT -4. The time now is 04:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.