CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   PHP coding error on site (http://www.codingforums.com/showthread.php?t=284670)

vaporman87 12-24-2012 06:25 PM

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?

tangoforce 12-24-2012 06:29 PM

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.

vaporman87 12-24-2012 06:43 PM

Quote:

Originally Posted by tangoforce (Post 1301972)
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.

tangoforce 12-24-2012 06:54 PM

So delete the ../ bit then.

vaporman87 12-24-2012 07:03 PM

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 12-24-2012 07:08 PM

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',
        ),


tangoforce 12-24-2012 07:33 PM

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):
http://i50.tinypic.com/fp03ev.jpg

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.

vaporman87 12-24-2012 09:28 PM

I see. Would editpad lite work? I'll give it a go.

vaporman87 12-24-2012 09:40 PM

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 12-24-2012 09:51 PM

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',
),
);

tangoforce 12-24-2012 10:15 PM

[php][/php] tags would have been nice. I've replied for you enough times for you to see it in my signature :rolleyes:

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.

vaporman87 12-25-2012 05:44 AM

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,
    ),
);


tangoforce 12-25-2012 10:00 AM

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.. :rolleyes:

vaporman87 12-25-2012 07:31 PM

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

tangoforce 12-25-2012 11:32 PM

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.


All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.