Search This Blog

Thursday, May 19, 2011

Print all form errors in a symfony form

foreach($form->getWidgetSchema()->getPositions() as $widgetName)
{
  echo $form[$widgetName]->renderError();
}


or you can use

$this->form->getErrorSchema();

Monday, May 2, 2011

Installing Apache, PHP, MySQL on Ubuntu


Install Apache 

Open Terminal (Application -> Accessories -> Terminal) and execute the following command:
sudo apt-get install apache2

check if the Apache is working properly by pointing your browser to http://localhost. If you see the text “It works!”, it means Apache is working.

Issue the following command to resolve following error Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

sudo  gedit /etc/apache2/conf.d/fqdn

When Gedit opens, type “ServerName localhost” inside the file and click Save

Install PHP



Inside Terminal, execute the following command:
sudo apt-get install php5 libapache2-mod-php5

execute this to restart apache

Execute the following command in Terminal:
    sudo /etc/init.d/apache2 restart

Install MySql

sudo apt-get install mysql-server



Inside Terminal, execute the following command:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Give the root password to complete the installation


Setting up phpunit in ubuntu



  1. Install PEAR . Issue the command sudo apt-get install php-pear.
  2. Make sure PEAR is up to date. Issue the command sudo pear channel-update pear.php.net
  3. Upgrade the PEAR elements. Issue the command sudo pear upgrade-all.
  4. Tell PEAR where to find the PHPUnit code. Issue the command sudo pear channel-discover pear.phpunit.de
  5. Install PHPUnit. Issue the command sudo pear install -a phpunit/PHPUnit. The -a makes sure all dependency packages are also installed.
  6. Issue the command phpunit --version. You should have version 3.3.17 or newer installed.
  7. Install XDebug. Issue the command sudo apt-get install php5-xdebug. This is needed if you want the HTML based coverage reports. 
  8. Restart the web server after installing this package. (sudo /etc/init.d/apache restart ).
reference