[SOLVED] Widget does not exist error after using unset to remove form fields in Symfony 1.x

I am getting started with Symfony 1.4 and I learnt that form elements can be removed by using unset. However, I got error similar to the following after using unset:

Widget ‘x’ does not exist

This was because the module still consisted of files referencing to those elements. So, it is necessary to re-generate module after making the changes. For example, if you are using Propel and if the module name is job and class name is JobeetJob in frontend, the following command should be run to re-generate module:

php symfony propel:generate-module --with-show frontend job JobeetJob

Hope this helps.

[SOLVED] Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

While trying to run a single-file php script in my Fedora 15 installation, I got a very strange error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required ‘/var/www/html/test/filename.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in Unknown on line 0

To get rid of this error, right click and go to Properties. Then, in Permissions, make sure it is readable by other users and it has a SELinux context httpd_user_content_t. That should do it.

[SOLVED] “[[WARNING]] The posix_isatty() is available: FAILED *** Install and enable the php_posix extension (used to colorized the CLI output) ***”

I ran the Symfony PHP Framework configuration check script in Fedora 15 and got the following error:

[[WARNING]] The posix_isatty() is available: FAILED
*** Install and enable the php_posix extension (used to colorized the CLI output) ***

To enable this extension, you should install php-process from Add/Remove Software or using yum.

su -c 'yum install php-process'

Run the check_configuration.php again and you should not see this warning again.

UPDATE: If you also see the following:

[[WARNING]] A PHP accelerator is installed: FAILED
*** Install a PHP accelerator like APC (highly recommended) ***

and want to have a PHP accelerator, you can install php-pecl-apc:

su -c 'yum install php-pecl-apc'

[HOWTO] Import photos from Facebook to Google Plus

Google Plus is still not available for public but is only available to invited users. However, many of you already have accounts via invitation. So, you may want to have all your photos from Facebook to Google+. Here is how you can do it.

Download data from Facebook
Login to your Facebook account and click on Account>Account Settings and click “learn more” link to next to Download Your Information. In that page, request to download your information. It might take a while for Facebook to gather all your information and send you a link in your email.

Extract and select photos for upload
Extract the archive and separate out photos if you don’t want every photo to be in your Google Plus account.

Upload to Google Plus
Login to Google Plus, click on the photos icon and then click on Upload New Photos button. Then click Select Photos From Your Computer button. You can select multiple files from the same folder by holding Ctrl or Shift. You can also select all files from the same folder by pressing Ctrl+A. After selecting files, don’t forget to enter album name. When done uploading, click on Create Album.

Hope this helps. Enjoy the Google+ experience.

[HOWTO] Compile Facebook hiphop-php in Fedora 15

HipHop for PHP is a source code transformer which transforms PHP code to C++ and compiles it with gcc/g++. I wanted to experiment with it and tried to install in on my PC with Fedora 15. Here is how I did it and how you can do it ( hopefully 🙂 ). Please note that this did not work and I will update the article soon.

Install Dependencies Available in the Repos
In the terminal, run the following command:

su -c 'yum -y install git cmake boost pcre-devel libicu-devel libmcrypt-devel oniguruma-devel mysql-devel gd-devel boost-devel libxml2-devel libcap-devel binutils-devel flex bison expat-devel re2c tbb libmemcached-devel tbb-devel bzip2-devel openldap-devel readline-devel libc-client-devel pam-devel gcc-c++ memcached'

Setup build environment
I compiled it in dev folder of home directory. Change directory in subsequent commands if you are doing it somewhere else. Run the following commands:

mkdir -p dev/local

Download hiphop-php

cd dev
git clone git://github.com/facebook/hiphop-php.git

Download, patch and compile libcurl and libevent
Use these versions because as of current, patches for these versions are only available in hiphop git.

cd dev

wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar xvzf libevent-1.4.13-stable.tar.gz
tar xvjf curl-7.20.0.tar.bz2

export CMAKE_PREFIX_PATH=`pwd`/local

cd libevent-1.4.13-stable
cp ../hiphop-php/src/third_party/libevent-1.4.13.fb-changes.diff .
patch < libevent-1.4.13.fb-changes.diff
./configure --prefix=`pwd`/../local
make install
cd ..

cd curl-7.20.0
cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
patch -p0 < libcurl.fb-changes.diff #see note-1 below

Note-1: While patching curl, you may be asked paths to the files. Enter includes/curl/multi.h and lib/multi.c respectively.

Now, you will need to make a small change in Makefile for it to compile properly. To do that open the file src/Makefile in gedit or any text editor, find the line that has the following:

curl_LDADD = $(top_builddir)/lib/libcurl.la -lz

and append -lrt so that the line looks like the following:

curl_LDADD = $(top_builddir)/lib/libcurl.la -lz -lrt

Now, run the following in the terminal:

cd dev/curl-7.20.0
./configure --prefix=`pwd`/../local
make install
cd ..

Compile hiphop-php

cd dev
export CMAKE_PREFIX_PATH=`pwd`/local
cd hiphop-php
git submodule init
git submodule update
export HPHP_HOME=`pwd`
export HPHP_LIB=`pwd`/bin
cmake . #see note-2 below
make #see note-3 below

Note-2: You may get errors while running cmake. This may be because of dependencies I might have missed above. In that case, please let me know the output of cmake in the comments so that I might be able to help.
Note-3: If you encounter any errors while using make, remove CMakeCache.txt and run make clean, cmake and make again.

This should have worked, but I am getting the following error:

../../bin/libhphp_runtime.a(ext_mysql.cpp.o): In function `HPHP::php_mysql_do_query_general(HPHP::String const&, HPHP::Variant const&, bool)’:
ext_mysql.cpp:(.text+0x8100): undefined reference to `cli_safe_read’
ext_mysql.cpp:(.text+0x826a): undefined reference to `net_field_length’
ext_mysql.cpp:(.text+0x83a0): undefined reference to `cli_safe_read’
ext_mysql.cpp:(.text+0x8712): undefined reference to `free_root’
collect2: ld returned 1 exit status
make[2]: *** [src/hphp/hphp] Error 1
make[1]: *** [src/hphp/CMakeFiles/hphp.dir/all] Error 2
make: *** [all] Error 2

It seems like a problem with mysql version in the Fedora repo. I will download and build mysql and update this post.

Further Reading


[SOLVED] No package ‘gtk+-3.0’ found

If you are trying to compile a gtk-3 application and if you don’t have development package installed here is the error you can get:

configure: error: Package requirements (gtk+-3.0 >= 3.0.0) were not met:

No package ‘gtk+-3.0’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTK_CFLAGS
and GTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

If you encounter this error in Fedora, you should install gtk3-devel. In terminal, type in the following:

su -c 'yum install gtk3-devel'

If you encounter this in Ubuntu, you should install libgtk-3-dev. To do so, type in the following in terminal:

sudo apt-get install libgtk-3-dev

Hope this helps.

[HOWTO] Install GPaste in Fedora 15

GPaste is a clipboard management tool for GNOME 3. It is not available in the repos and must be downloaded via git and compiled. Here is how you can do it:

GPaste is now available in the repos, so you can install it by using Add/Remove Programs or by running the following commands in the terminal:

yum install gpaste

That should install GPaste. The following post is for historical reasons only.

Install Git

su -c 'yum install git'

Download GPaste sources

cd; git clone https://github.com/Keruspe/GPaste.git

Install Dependencies

su -c 'yum install gtk3-devel glib2-devel intltool automake autoconf vala'

Compile and Install

cd;cd GPaste
./configure --prefix=/usr
su -c 'make install'

Restart GNOME Shell
To restart, press Alt+F2, enter ‘r’ (without quotes) and press enter.

You should now see GPaste icon in the top panel.

[HOWTO] Open djvu files in Fedora 15

Support for djvu files is not included in Fedora default installation, however, it can be installed from the repository. To add djvu support to the default document viewer (Evince) run the following in terminal:

su -c 'yum install evince-djvu'

If you want to install a different reader for djvu files, you can do so by installing djview. To install djview, type in the following in terminal.

su -c 'yum install djview4'

Hope this helps.