Differences between production and development "server"

Hello Yii-Members,

I’ve got a question. I developed with Yii and I “deployed” yesterday for the first time on a remote server. PHP-, MySQL- and Apache"-Version are identically.

But although I had two identically server-setups and configs with the same files and code, there were differences and errors on the remote server.

One Example:

I have a "util-class" called MyUtils.php (in the folder "protected/components/MyUtils.php". Example Code:

class MyUtils


     public function getCompanyByUserID($userID){




And I use for example this function anywhere in the code like this: "MyUtils::getCompanyByUserID($userID)"…

Locally it runs perfect - but on the remote server it crashs and displays an error with an advice I should change the method to a static method.

If I change the method declaration to "public static function getCompanyByUserID($userID){//}" it works also on the remote system.

So my Question is, why is there a difference and what do I have to change or do, if I want to have identically environments. Is it a property or what? I don’t know, please can you give me some help.

Thank in advance.


The live server is right, you didn’t code it correctly .

The difference between the two servers might be on the error reporting.

Anyway, if you want to use static methods be SURE you declare them static and you won’t have problems in any other environment.

Thanks for your reply.

My post was not exactly for this kind of error, that was only an example. My Question is generally, why there are differences between the localhost and a remote server. I didn’t change anything like “switching to production mode” or something else. But the Question still exists for this example, why don’t I get an error for this “static”-thing on localhost? :wink: (Ok the missing static declaration is wrong, but I expect an error on localhost as well!).

That it might be the error reporting is only a suggestion from you, right? So, I’m not sure if the error reporting causes a “500”-crash and on localhost it does not. Google didn’t helped me with that.

But thx :slight_smile:

It is not likely that your both environments are the same, i really doubt this .

I am sure there are differences.

For php, just be sure you run same version on both environments, then copy the php.ini file from your live server to the development one.

This should take you to the closest step between servers, BUT keep in mind that it is important the way the PHP was compiled when installed. If on localhost you run xampp/wamp therefore, windows and on the production server you run linux, then i am sure it is a huge difference in the way the php was compiled .

Btw, the 500 error is not a PHP error, it is something that apache produces, most likely because of the mod rewrite .

Sounds like PHP in live server is older than 5.3.0

More info here.


Compare your php.ini. error_reporting should be different.