7

I am trying to configure MS-MSQL database on cakephp (Not mysql).

My Wampserver is 2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b on my laptop (which is windows x64-bit.

I already invited these two dlls to run sql server
extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dll

I've got these two errors in running cakephp 1.3

Strict standards: Redefining already defined constructor for class Object in C:\wamp\www\project\cake\libs\object.php on line 54<br/>
Strict standards: Non-static method Configure::getInstance() should not be called statically in C:\wamp\www\project\cake\bootstrap.php on line 38

I also install WampServer2.1e-x32 it didn't work :(

Any help plz

Fury
  • 4,643
  • 5
  • 50
  • 80

4 Answers4

24

you are using newer php version. in php 5.4, E_STRICT is part of E_ALL

in cake 1.3, open file /cake/bootstrap.php and change the error_reporting like this

error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);

risnandar
  • 5,513
  • 1
  • 26
  • 17
  • after using this `error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);` it gives me a blank page... i am using xampp v3.1.x.x with PHP Version 5.4.7 and i am working with cakephp 1.2 – MuntingInsekto May 14 '13 at 03:24
  • 1
    make sure your display_error is enabled in php.ini or by using ini_set('display_errors', 1); – risnandar May 25 '13 at 01:46
  • 8
    Hiding errors is not a feasible solution. According to me it is more important to resolve fatal/warnings/notice errors first if it is possible. Thanks – Arun Jain Jul 09 '13 at 06:32
  • 2
    Yes Arun, resolve all errors is number one priority but there is some case when you're in the middle of deadline and you must run the application ASAP for your company/client, and that apps built by someone you don't know. This must be temporary fix. Thanks for your suggestion – risnandar Jul 12 '13 at 15:55
  • 3
    Isn't there a solution to change the cake-sources, so that error is fixed instead of ignoring it? **How would you fix object.php on line 54 so it will not throw the strict warning?** – rubo77 Nov 15 '13 at 10:06
6

Your cakephp version is old, and has problems with the latest version of PHP.

You could try updating your CakePhp version. Seems that your are using the 1.3 version, so update to the latest one. You could find it

https://github.com/cakephp/cakephp/archives/1.3

Only replacing the cake/ folder with the new one, you fix this problem.

If you are new to CakePHP, then it is better to learn the Latest framework 2.2.1. You will be easily installed this framework with your Wamp.

Arun Jain
  • 5,476
  • 2
  • 31
  • 52
  • Thank you for you answer I will try that. But this framework(that is cakephp 1.3) is an existing framework and it is working properly with WampServer2.1e-x32 .... What I impose is **it can't connect to SQL SERVER database** properly – Fury Aug 27 '12 at 09:18
  • At the below of the error you are getting, there might be a link `context`. Click on it and check. Remember you provided the correct database connection string in `$default` or otherwise you will have to use `$useDbConfig`. – Arun Jain Aug 27 '12 at 09:46
  • I tried the newest version of cakephp 2.2.1. it gives me database error: `Notice (8): Undefined index: datasource [CORE\Cake\Model\ConnectionManager.php, line 258]` `Cake is NOT able to connect to the database.` `Datasource class could not be found.` – Fury Aug 27 '12 at 09:47
  • Hi Arun! There is no link for context. – Fury Aug 27 '12 at 09:53
  • 1
    This should have been marked as the correct answer. Had the same issue after updating to php 5.4. Updating cake from 1.3.12 to 1.3.17 fixed the issue. Keeping your cake up to date should be a best practice – 321zeno Jul 08 '13 at 17:51
  • The cakephp/archives/1.3 is gone, but you could get older versions you clone the cakePHP Project on github: https://github.com/cakephp/cakephp/ and then [checkout the right revision for your version.](http://www.botsko.net/blog/2010/01/08/download-old-cakephp-versions/) – rubo77 Nov 18 '13 at 09:37
0

Go into your Config/core.php and look for the error handler configuration:

Configure::write('Error', array(
    'handler' => 'ErrorHandler::handleError',
    'level' => E_ALL & ~E_DEPRECATED,
    'trace' => true
));

and replace 'level' with this:

...
'level' => E_ALL & ~E_STRICT & ~E_DEPRECATED,
...
Claudio Bredfeldt
  • 1,423
  • 16
  • 27
0

The solution is to update the cake 1.3 version to the last release currently the 1.3.21 .

click here to download the last release :

https://github.com/cakephp/cakephp/tags

Vindic
  • 627
  • 6
  • 8