 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

November 13th, 2003, 06:17 PM
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 13th, 2003, 10:53 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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/
|

November 13th, 2003, 10:55 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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/
|

November 14th, 2003, 11:03 AM
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 14th, 2003, 01:11 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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/
|

November 14th, 2003, 01:54 PM
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 14th, 2003, 02:08 PM
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 14th, 2003, 07:57 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Glad it's working!
Take care,
Nik
http://www.bigaction.org/
|

November 14th, 2003, 09:00 PM
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks for all your help man, couldn't've done it without you!!
jon
|
|
 |