CakePHP 3.0 installation: intl extension missing from system

I faced the same problem today. You need to enable the intl PHP extension in your PHP configuration (.ini). Solution Xampp (Windows) Open /xampp/php/php.ini Change ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon) Copy all the /xampp/php/ic*.dll files to /xampp/apache/bin Restart apache in the Xampp control panel Solution Linux (thanks to Annamalai Somasundaram) Install the php5-intl extension … Read more

Fat models, skinny controllers and the MVC design pattern

It’s a bit tough to give you the “right” answers, since some of them deal with the specifics of the framework (regardless of the ones you are working with). At least in terms of CakePHP: Yes Anything that deals with data or data manipulation should be in a model. In terms of CakePHP what about … Read more

How do you make strings “XML safe”?

Since PHP 5.4 you can use: htmlspecialchars($string, ENT_XML1); You should specify the encoding, such as: htmlspecialchars($string, ENT_XML1, ‘UTF-8’); Update Note that the above will only convert: & to &amp; < to &lt; > to &gt; If you want to escape text for use in an attribute enclosed in double quotes: htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, ‘UTF-8’); … Read more

Best way to document Array options in PHPDoc?

This is how I do it instead: /** * Class constructor. * * @param array $params Array containing the necessary params. * $params = [ * ‘hostname’ => (string) DB hostname. Required. * ‘databaseName’ => (string) DB name. Required. * ‘username’ => (string) DB username. Required. * ‘password’ => (string) DB password. Required. * ‘port’ … Read more

“[notice] child pid XXXX exit signal Segmentation fault (11)” in apache error.log [closed]

Attach gdb to one of the httpd child processes and reload or continue working and wait for a crash and then look at the backtrace. Do something like this: $ ps -ef|grep httpd 0 681 1 0 10:38pm ?? 0:00.45 /Applications/MAMP/Library/bin/httpd -k start 501 690 681 0 10:38pm ?? 0:00.02 /Applications/MAMP/Library/bin/httpd -k start … Now … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)