arn_php Posted February 5, 2008 Share Posted February 5, 2008 Hi there, I have been trying to make this config.php below to work on php5 environment. Any error? I can't see any. Or maybe I miss a thing here. I know that I could find help from php.net, from its documentation section. But to be honest with you, the more I read the more confuse I am. Well, I don't have any basic education on php at all. So please help. Here is the background of this issue. I have this script written in php4 originally but then we need to move to php5. So I tried to load my site into php5 server and found out that the config.php file is not read properly by php5. The config.php below is actually linked from index.php with this code: <?php include_once('_init.php'); ?> then from _init.php: <?php session_start(); include_once('config.php'); // and some other codes $_SESSION['init'] = 'done'; ?> Here is the config.php: <?php // Site title define('SITE_TITLE', 'My Title goes here'); // contact title define('CONTACT_TITLE', 'Website Contact form'); // contact form email define('CONTACT_EMAIL', 'my@email.com'); define('ADMIN_EMAIL', 'my@email.com'); // sessions define('SESS_USER', 'my_user'); define('SESS_ADMIN', 'my_session'); //date formatting define('DATE_FORMAT', 'd-m-Y'); define('DATE_FORMAT1', 'd-m-Y H:i'); //PATHS define('PATH_DATA_FILES', 'data_files/'); define('PATH_INCLUDES', 'includes/'); //paths for DYNAMIC EXTRANET define('EXTRANET_DIRECTORY', '../'); define('EXT_DIR_PARAMETERS', 'parameters/'); //************************************************************************************************* ?> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 5, 2008 Share Posted February 5, 2008 i copied your script to my server using same file names on php 5.1.6 i got no errors are you sure the errors are not being caused by another part of your scripts Scott. Quote Link to comment Share on other sites More sharing options...
Cep Posted February 5, 2008 Share Posted February 5, 2008 I thought you said this was the config.php? So why does it have, <?php session_start(); include_once('config.php'); (and some other codes) Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 5, 2008 Share Posted February 5, 2008 I thought you said this was the config.php? So why does it have, <?php session_start(); include_once('config.php'); (and some other codes) no that code is from _init.php it calls config.php the third block of code from arn_php is config.php the first line <?php include_once('_init.php'); ?> is from index.php the second set is _init.php and the last set is config.php Scott. Quote Link to comment Share on other sites More sharing options...
PHP Monkeh Posted February 5, 2008 Share Posted February 5, 2008 What exactly is the error you're getting? Giving us the error will help us pinpoint and know what to look for. Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 5, 2008 Author Share Posted February 5, 2008 When I run this website into php5 environment, the config.php is not read properly. As example, the site title is not read as "My Title goes here" but "<?= SITE_TITLE; ?>". Same as others.. are you sure it runs well on yours? What do I do wrong? Or do you think it was on other file that cause it? Actually others are running just fine. Into the _init.php: (everything works ok, only the config.php isn't read properly) <?php session_start(); include_once('config.php'); include_once('includes/function.php'); include_once('parameters/parameters_multilanguage.php'); include_once('parameters/config_arrays.php'); include_once('parameters/parameters_mysql.php'); include_once('parameters/parameters_extranet_paths.php'); $connection = @mysql_connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASS) or error_report($PHP_SELF, 'MYSQL_CONNECT', mysql_error()); @mysql_select_db(MYSQL_DB) or error_report($PHP_SELF, 'MYSQL_SELECT_DB', mysql_error());; $_SESSION['init'] = 'done'; ?> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 5, 2008 Share Posted February 5, 2008 Always use full php opening tags <?php. If you change <?= to <?php echo it should start to work. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 5, 2008 Share Posted February 5, 2008 i added print_r($GLOBALS); to index.php and none of the vars set using define were there this has me stumped Scott. Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 6, 2008 Author Share Posted February 6, 2008 To: PFMaBiSmAd Do you mean if I use <?php echo 'SITE_TITLE'; ?> will work insted of <?= SITE_TITLE; ?> ? If so, is there any shorten ways to fix this? I mean I have about 150 sites to fix then.. To: ratcateme What do you mean of adding print_r($GLOBALS); to index.php? Do you mean to add it as something like this: <?php include_once('_init.php'); print_r($GLOBALS); ?> Will it help the issue above? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 6, 2008 Share Posted February 6, 2008 You can turn short open tags on, assuming you have access to the php.ini or you are on a server where you can use a .htaccess file or a local php.ini file. Quote Link to comment Share on other sites More sharing options...
awpti Posted February 6, 2008 Share Posted February 6, 2008 set this in PHP.ini: short_open_tag = On If you don't have access to it.. have fun fixing it By the way, it wouldn't be <?php echo 'SITE_TITLE';?>.. it'd be <?php echo SITE_TITLE;?> Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 6, 2008 Author Share Posted February 6, 2008 Thanks for the help. I will try and let you know. Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 23, 2008 Author Share Posted February 23, 2008 Ok, I have the short_tags ON,the website is ok (http://www.edubenefit.com) but then the extranet I have is a mess now. you may take a look here: http://www.edubenefit.com/extranet (can't access it, why? in php4, it works just fine) http://www.edubenefit.com/extranet/index.php (you have add the index.php to pull up the page but then you can see there is an error on the top: "Notice: Constant DELETE_IMAGE_REQUIRED already defined in d:\edubenefit.com\extranet\language.php on line 92" What is this? in php4 everything is smooth) What do I need to do? the phpinfo is this: http://www.edubenefit.com/info.php (I do not have access to the config of its php, if I do what I need to change in order to make the extranet to work?) Thanks, Arnold Quote Link to comment Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 Abbout DELETE_IMAGE_REQUIRED it's already defined so you can comment it out or test it if (DELETE_IMAGE_REQUIRED==""){[...]} Can you post the required code for the rest of your question? that would help thx Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 23, 2008 Author Share Posted February 23, 2008 Thanks, do you know why I can't access the extranet just adding /extranet after the domain as before? I have to put /extranet/index.php now. By the way, once I log in, this is the error message I received: Notice: Use of undefined constant ENABLE_ACCESS_LOG - assumed 'ENABLE_ACCESS_LOG' in d:\edubenefit.com\extranet\login.php on line 29 Warning: Cannot modify header information - headers already sent by (output started at d:\edubenefit.com\extranet\login.php:29) in d:\edubenefit.com\extranet\login.php on line 41 Warning: Cannot modify header information - headers already sent by (output started at d:\edubenefit.com\extranet\login.php:29) in d:\edubenefit.com\extranet\login.php on line 43 It should actually take me to main.php. Quote Link to comment Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 If you would like help out of me at least post me the code related to the errors lol or else theres not much i can do for you. Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 24, 2008 Author Share Posted February 24, 2008 I have been trying to post a reply but the page bounce back empty. Anything wrong? Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 24, 2008 Author Share Posted February 24, 2008 I have been trying to paste the login php here, but then the page bounce me blank all the time. Here is the line 29: if((ENABLE_ACCESS_LOG == 1) && is_dir(EXT_SERVER_PATH.'logs/')){ And here is the line 41 to 43: setcookie('cms_authentification', md5(session_id()), time()+3600*60); mysql_close($connection); header("Location:main.php"); Quote Link to comment Share on other sites More sharing options...
arn_php Posted February 24, 2008 Author Share Posted February 24, 2008 I actually commented it out like this: /* if((ENABLE_ACCESS_LOG == 1) && is_dir(EXT_SERVER_PATH.'logs/')){ blah... blah... }*/ Then it works fine, taking me to main.php. What does that do actually, I mean the code above. Why is it working just ok in php4 but not in php5. Is there anything I need to change on the php config file in this php5? Anyhow, when I am in main.php.. this is the error messages that show up (so much trouble with this php5 - can anybody help me please?): Notice: Undefined index: mainsection in d:\edubenefit.com\extranet\libs\lib_extranet_util_functions.php on line 114 This is the code on line 114 of lib_extranet_util_functions.php: if($row['esid'] == $_GET['mainsection']){ echo '<img src="imgs/icon_arrow_down.gif" /> <a href="main.php?'.generate_url_parameters(array('mainsection'=>$row['esid']), 'new').'" class="menu_on">'.stripslashes($row['name']).'</a>'; echo '<br /><div class="submeniu">'; generate_submenus($row['esid']); echo '</div>'; }else{ Another error messages on main.php Notice: Undefined index: op in d:\edubenefit.com\extranet\main.php on line 82 Notice: Undefined index: section in d:\edubenefit.com\extranet\main.php on line 154 switch($_GET['op']){--------------> line 82 if( (($_GET['section'] != '') && ($_GET['section'] != 'mainmenu')) ){--------------> line 154 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.