Category Archives: Web - Page 2

Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …

While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:

ErrorException: Notice: serialize() [function.serialize]: "entity_property" returned as member variable from __sleep() but does not exist in ...vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php line 27

This error was happening because my “entity_property” was declared as private and PHP has some issues serializing objects that subclass a class with private properties. Just changing that “entity_property” to protected (as it should always have been…) solver the error.

Ref: http://blog.geertvd.be/2011/09/25/symfony2-id-returned-as-member-variable-from-__sleep-but-does-not-exist

Install PHPUnit in Mac OS X with pear

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit

Solve “The Alias directive in … will probably never match because ir overlaps an earlier Alias”

This is a warning that happens when starting Apache2.

$ sudo service apache2 restart
 * Restarting web server apache2                                                [Wed May 08 11:55:52 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
 ... waiting [Wed May 08 11:55:54 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
                                                                         [ OK ]

It is caused because the configuration for phpMyAdmin is loaded 2 times: in /etc/apache2/conf.d/phpmyadmin.conf and /etc/apache2/apache2.conf with an include to /etc/phpmyadmin/apache.conf.

To get rid of this warning just comment out this line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf

Install and activate xdebug in MacPorts

First install php5-xdebug:

sudo port install php5-xdebug

Then just add these in your php.ini (probably /opt/local/etc/php5/php.ini), but first verify the file path for zend_extension option:

; NOTE: This line adds the xdebug extension. The macports install will give you the path, 
; or may even add this automatically. Be smart, look for a similar line in your config first.
; (Edit: 06/22/2012)
zend_extension="/opt/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

; General config
;Dumps local variables on exception
xdebug.show_local_vars=On
;Dump server variables
xdebug.dump.SERVER=*
;Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;

; Tracing
xdebug.auto_trace=On
xdebug.trace_output_dir=/opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On

; Profiler
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/opt/local/php_traces

; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1

Ref: http://www.littleblackhat.com/blog/2009/02/getting-xdebug-working-on-mac-os-x-with-macports/

Install Doctrine2 with PEAR in MacPorts

Run those commands:

sudo /opt/local/bin/pear channel-discover pear.doctrine-project.org
sudo /opt/local/bin/pear channel-discover pear.symfony.com
sudo /opt/local/bin/pear install -a pear.doctrine-project.org/DoctrineORM-2.3.3
sudo /opt/local/bin/pear install pear.doctrine-project.org/DoctrineSymfonyConsole
sudo /opt/local/bin/pear install pear.doctrine-project.org/DoctrineSymfonyYaml

Then running doctrine -v should work but /opt/local/lib/php must be in the include_path of your PHP installation. I tried to include it in my /opt/local/etc/php5/php.ini file but didn’t work, so I added this line as the very first line in /opt/local/bin/doctrine.php:

set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/local/lib/php');

Then everything worked fine.

Ref: http://delboy1978uk.wordpress.com/2012/06/26/installing-doctrine-2-2-2-on-mac-os-x/

  • Page 2 of 5
  • <
  • 1
  • 2
  • 3
  • 4
  • 5
  • >