Today I found a bit strange situation to me. I opened Gii installed inside my website and when tried to use it to generate model for one of my tables I got error: “Maximum execution time of 60 seconds exceeded in D:\Dev\xampp\yii\db\CDbCommand.php on line 364” followed by “Maximum execution time of 60 seconds exceeded in D:\Dev\xampp\yii\web\CHttpSession.php on line 108”. It repeats, so right now I’m unable to generate Model, for the first time in whole Yii history!
The strangest part is that both DB connection is 100% properly configured and communication to server and DB works like a charm, because seconds after error message from Yii I go to my webapp main page, where in view I wrote a sample SQL statement to test if everything is OK with DB, connection and configuration (I know that using SQLs in view is a very bad manner, but it was just a temporal test).
In other words - I can use my website normally, connection to DB works, results from DB are generated within nanoseconds (all right, I’m kidding, but really fast) and in the same time Gii failes to generate really simple model (table with four columns and three records) with 60 seconds timeout.
I have no bloody idea, what can be wrong? Can it be that this strange Gii behaviour is related to using Oracle as RDBMS (never used Gii on it before, always on SQLite or MySQL)? Or that table name contains underscore (_) in name <-- that suspicion is made after attempt with using Giix instead of Gii. It failed too, but not with timeout only with error message that… DB table name can only contain letters, dots and optional asterisk at the end.
Has anyone run into the same situation? Is there anything I can do right now or the only solution left to me is to write model classes by hand?
Since I’m using Gii, there are no parts of my code. Gii is hanging with timeout. Rest of webpage works fast, with no problems. Therefore I think that this has to be something different, than connection to database. DB is on the same computer as Yii app (accessed locally via localhost). And I’m able to display whole WWW_USERS table within less then one second, while Gii can’t create model for this table within 60 seconds. This must be something different, but what?
Yes, I know. But in my opinion this will not change anything as rest of the page works fine only Gii hangs with timeout.
P.S.: It hangs on Preview stage. I wasn’t even able to go to actual file creation step.
I don’t see other way to this than to debug… line by line… or better method by method… until you find where is the bottleneck… could be that in the end you find something that needs to be improved in Gii
I would rather say that this is caused by Oracle and ActiveRecord at all. I heard at least five different people saying that I’m mad trying to use PHP with Oracle in ActiveRecord manner and that DAO is the only option. Which, to be honest, makes me sad, as I have to use Oracle and love AR.
I’ll do some debug to see if I can find something specific.
For right now I have two additional observations:
[list=1]Connection works for sure, even inside Gii. If I type non-existing table name into Model generator it is handled without any problems and after 2-3 second I receive correct error message saying that table was not found in database.I have strange problems enlarging max_execution_time setting in php.ini. I’ve set it to 600 seconds but Gii still hangs after only 60 seconds. I’ve tried to both restart server (Apache2 inside XAMPP 1.7.3) and whole machine running it, with no result - still hanging on 60 seconds, though configuration remains set to 600 seconds. They wrote here that they might be something overwritten in server configuration itself. For example: Apache has a Timeout directive, according to mentioned document. But I can’t find neither this nor any other time-related directive inside httpd.conf, therefore I have no idea, why scripts hangs after only 60 seconds.[/list]
The only think that surprises me is that only Gii fails on it. I’m using Active Record (as Gii uses, if I’m not mistaken) in the same application and it works very well - i.e. all models and CRUD files I generated with Gii to another project and only adopted to this Oracle application works fine. This would suggest that even if COciSchema reports the error, it should be somewhere inside Gii, not Active Record. Am I right?
About using cache I answered in article (as comment to it).
I’m not pretty sure, if this is a good idea to saying users that something is not working, because you’re not using cache? Cache isn’t obligatory or mandatory to be used in every project and Gii should work also without it for Oracle. Sorry, but I find is as a bug and that is why I reported it here to gather more information about it.