Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2012, 06:25 PM   PM User | #1
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
PHP coding error on site

I receive the following error at my current website:

Code:
Warning: require_once(/home/vaporman/public_html/../medical/framework/yii.php) [function.require-once]: failed to open stream: No such file or directory in /home/vaporman/public_html/index.php on line 12

Fatal error: require_once() [function.require]: Failed opening required '/home/vaporman/public_html/../medical/framework/yii.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vaporman/public_html/index.php on line 12
What seems to be the issue?
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 06:29 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Code:
Warning: require_once(/home/vaporman/public_html/../medical/framework/yii.php) [function.require-once]: failed to open stream: No such file or directory in /home/vaporman/public_html/index.php on line 12
The red bit is probably the error. You're trying to change up outside of public_html into another directory outside of it. I suspect medical is actually inside public_html not above it.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
vaporman87 (12-25-2012)
Old 12-24-2012, 06:43 PM   PM User | #3
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
Quote:
Originally Posted by tangoforce View Post
The red bit is probably the error. You're trying to change up outside of public_html into another directory outside of it. I suspect medical is actually inside public_html not above it.
Yes. There is nothing outside of public_html related to the site.
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 06:54 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
So delete the ../ bit then.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
vaporman87 (12-25-2012)
Old 12-24-2012, 07:03 PM   PM User | #5
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
I fixed that issue. Now a new error:
Code:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/vaporman/public_html/protected/config/main.php on line 58
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 07:08 PM   PM User | #6
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
The line in RED is line 58. ???
Code:
),
		// uncomment the following to use a MySQL database
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=*************',
			'emulatePrepare' => true,
			'username' => '**********',
			'password' => '**********,
			'charset' => 'utf8',
		),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 07:33 PM   PM User | #7
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Thats not the complete line. It's part of a function call spread over multiple lines (hence the , characters).

What you need to do is use a program like notepad++ which has line numbering built in and will show you the REAL line 58.

What you have shown me is something you THINK is line 58 but it actually isn't because it's been wrapped over multiple lines.

Look at this for an example of how multiple lines do NOT increment the line number - in otherwords if it's wrapped, it shouldn't (unless you pressed return) have its own line number (look at lines 6 and 16):


But just in case, try deleting the , at the end of this: 'charset' => 'utf8',

Otherwise you're going to need to post the entire script or at least a large amount more of it.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.

Last edited by tangoforce; 12-24-2012 at 07:39 PM..
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
vaporman87 (12-25-2012)
Old 12-24-2012, 09:28 PM   PM User | #8
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
I see. Would editpad lite work? I'll give it a go.
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 09:40 PM   PM User | #9
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
Hmmm. Is there some type of view or format that Notepad++ should be set to, because simply opening the file in Notepad++ still shows that as line 58, with no jumps in line number because of "wrapping".
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 09:51 PM   PM User | #10
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
Here is the script:

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(

'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Retro-Daze',
'defaultController' => 'site',

// preloading 'log' component
'preload'=>array('log'),

// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),

'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'ashu',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),

// application components
'components'=>array(

'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=*************',
'emulatePrepare' => true,
'username' => '**********',
'password' => '*********,
'charset' => 'utf8',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),

// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'ashutosh2801@gmail.com',
),
);

Last edited by vaporman87; 12-24-2012 at 09:55 PM..
vaporman87 is offline   Reply With Quote
Old 12-24-2012, 10:15 PM   PM User | #11
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
[php][/php] tags would have been nice. I've replied for you enough times for you to see it in my signature

Where did you get this code? It's awfully formatted and frankly I found it hard to match up any ( and ) symbols.

This line (actually 58): 'password' => '*********,

Has a missing ' at the end of the * characters and again on line 145.

On line 88 you have this:
); <?php

You're reopening PHP when the code is already in PHP. That will cause more problems. Who wrote this? I don't like it.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.

Last edited by tangoforce; 12-24-2012 at 10:18 PM..
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
vaporman87 (12-25-2012)
Old 12-25-2012, 05:44 AM   PM User | #12
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
Sorry for that. I'm a bit of a novice. The code was written by a developer I hired from Freelancer.com. They had high marks, but that doesn't always mean something.

PHP Code:
<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    
'name'=>'Retro-Daze',
    
'defaultController' => 'site'

    
// preloading 'log' component
    
'preload'=>array('log'),

    
// autoloading model and component classes
    
'import'=>array(
        
'application.models.*',
        
'application.components.*',
    ),

    
'modules'=>array(
        
// uncomment the following to enable the Gii tool
        
'gii'=>array(
            
'class'=>'system.gii.GiiModule',
            
'password'=>'ashu',
             
// If removed, Gii defaults to localhost only. Edit carefully to taste.
            
'ipFilters'=>array('127.0.0.1','::1'),
        ),
    ),

    
// application components
    
'components'=>array(
    
        
'user'=>array(
            
// enable cookie-based authentication
            
'allowAutoLogin'=>true,
        ),
        
// uncomment the following to enable URLs in path-format
        
'urlManager'=>array(
            
'urlFormat'=>'path',
            
'showScriptName' => false,
            
'rules'=>array(
                
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
                
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),
        
'db'=>array(
            
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),
        
// uncomment the following to use a MySQL database
        
'db'=>array(
            
'connectionString' => 'mysql:host=localhost;dbname=********',
            
'emulatePrepare' => true,
            
'username' => '**********',
            
'password' => '*******,
            '
charset' => 'utf8',
        ),
        '
errorHandler'=>array(
            // use '
site/error' action to display errors
            '
errorAction'=>'site/error',
        ),
        '
log'=>array(
            '
class'=>'CLogRouter',
            '
routes'=>array(
                array(
                    '
class'=>'CFileLogRoute',
                    '
levels'=>'errorwarning',
                ),
                // uncomment the following to show log messages on web pages
                /*
                array(
                    '
class'=>'CWebLogRoute',
                ),
                */
            ),
        ),
    ),

    // application-level parameters that can be accessed
    // using Yii::app()->params['
paramName']
    '
params'=>array(
        // this is used in contact page
        '
adminEmail'=>'ashutosh2801@gmail.com,
    ),
);

Last edited by vaporman87; 12-25-2012 at 06:00 AM..
vaporman87 is offline   Reply With Quote
Old 12-25-2012, 10:00 AM   PM User | #13
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
IF you re-read my last post, you'll see that I've posted my comments on 3 faults I found for you to fix.

As for the developer..
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
vaporman87 (12-25-2012)
Old 12-25-2012, 07:31 PM   PM User | #14
vaporman87
New to the CF scene

 
Join Date: Dec 2012
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
vaporman87 is an unknown quantity at this point
Thank for that Tango. With your help I was able to get the site running. Though, I am finding some bugs. Here is one error I encountered and it's respective code:

Code:
Fatal error: Call to undefined method stdClass::update() in /home/vaporman/public_html/protected/controllers/SiteController.php on line 1231
PHP Code:
        Yii::app()->user->setFlash('msgError','Sorry, your reply could not be posted. Please try again.');
            }
            
        }
        else
        {
            
$forum->views+=1;
            
$forum->update();
        }
        
        
$cat ForumCategory::model()->findByPk($forum['category_id']); 
$forum->update(); is line 1231. Any thoughts, or need more info?

This error occurs when a user is logged in to my site and views a forum thread, then clicks the "RetroDaze" logo to return to the home page.
The site is located here: www.retro-daze.com

Last edited by vaporman87; 12-25-2012 at 07:35 PM..
vaporman87 is offline   Reply With Quote
Old 12-25-2012, 11:32 PM   PM User | #15
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
I don't do object oriented programming (which is what your code is relating to) so can't comment on it really I'm afraid.

Have you tried asking the original coder to fix this? It is their responsibility really - if they can't write working code then they need to fix it for you.

Others here may be able to help you but it may be a bit long winded.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:34 PM.


Advertisement
Log in to turn off these ads.