The PHP development team today released PHP 5.3.2 which includes many bug fixes, added some security improvements and implemented many more changes. You can go to the PHP site and download it right away from your preferred mirror, but if you are a ServerGrove VPS customer you can open a support ticket and we will upgrade it for you. If you plan to get a VPS with PHP 5.3 make sure to select the 5.3 version when you place your order and we will install the latest version.
As is the case with any upgrade, some applications may not run with PHP 5.3 so make sure your site or application is ready for the upgrade. The benefits of upgrading to PHP 5.3 are plenty, lots of new features and significant speed and memory management improvements which is big by our book.
Some PHP applications already require PHP 5.3, the most known ones are Symfony 2.0 and Lithium. If you need to develop with PHP 5.3, we recommend you to take a look at Zend Server CE 5.0 for your development environment, which we just wrote a blog post about it.
Zend just released Zend Server 5.0 a couple of days ago. As it has been the case for the previous versions, when downloading you can choose to get a version with PHP 5.2 or 5.3.
The Zend Server is available on Linux, Mac OS X and Windows, covering the wide spectrum of platforms making it an attractive development platform. This is specially important for Windows and Mac users where having a solid PHP installation is not so simple. The Zend Server comes with a complete PHP stack along with the most common extensions included. It also comes with a debugger which interfaces with Zend Studio allowing developers to put breakpoints in their PHP code.
Installation on my Mac with OS X went very smoothly. Everything was installed on /usr/local/zend. After completing the installation this is what I did to “fix” the installation for my needs:
edited Apache’s config (/usr/local/zend/apache2/conf/httpd.conf) and added the following line so Apache listens on the standard web port. Listen 80
Added my virtual hosts to conf/extra/httpd-vhosts.conf. Make sure this file is included in the main httpd.conf file with the following line: Include conf/extra/httpd-vhosts.conf
edited Mysql’s config (/usr/local/zend/mysql/data/my.cnf) to allow network connections by commenting the line skip-networking.
I restarted Zend server which in turns restarts Apache and Mysql with sudo /usr/local/zend/bin/zendctl.sh restart
I did notice that if you want to connect to mysql from PHP using localhost, it fails because it does not find the mysql.sock in /tmp. I fixed this by created a link with this command: sudo ln -s /usr/local/zend/mysql/tmp/mysql.sock /tmp/
That’s pretty much it. After a few minutes, I had PHP 5.3 running and my Symfony/Zend Framework projects were up and running. By having the latest version of PHP 5.3, I am now able to play around with the newly released alpha version of Symfony 2.0!
The Wordpress autoupdate feature allows Wordpress to automatically download and install updates on your Wordpress. It’s one of the best features in Wordpress and usually performs a clean update in a matter of seconds without you having to mess around with your files. One of the downsides of autoupdate is that it does not support SFTP out of the box. There are several tutorials explaining how to recompile PHP to enable SFTP in Wordpress, but the best way to get around this is to bypass using SFTP, FTPS and FTP altogether and assigning the correct permissions to your files so the web server can have write permissions.
Log into your account using SSH and type:
chown apache /var/www/blog -R
Note: Some Linux distros use other users for Apache, like httpd, wwwuser, or wwwdata. Check the User directive in your Apache configuration to make sure you assign the right user to your files.
Be sure to replace the /var/www/blog with the path to your Wordpress installation. And that’s it. Wordpress should take care of the rest.
All our servers have been upgraded but if you are using the admin generator in your site, it is important that you clear the symfony cache. On shared hosting you can do so by login to the Control Panel and using Maestro. On a VPS, through SSH and as root run the following command: “cd /usr/local/php; git pull” and then clear your symfony cache.
A big topic during Symfony Live 2010 was the need of quality web applications developed using symfony. CMS (content management system) applications are core to modern web development and until recently, even just 6 months ago or so, there were few available options built in symfony. Projects like SimpleCMS and Sympal had been started and while they showed potential, they were still in the early stages of development.
This scenario has changed quite a bit in the past month. At the time of this post, there are three major open source CMS applications: Apostrophe, Diem and Sympal. We expect a fair number of these apps to be installed on our platform so we decided to dig in and test them out. As with any application, no CMS can fit everybody’s needs and workflow, so we don’t think there is one CMS that will rule them all. The idea is not to find the best CMS, but to highlight the strengths and weakness of each option and comment on any places where we see room for improvement. Of course, these projects are relatively new, so I am sure there will be plenty of room for improvement and with time and contributions from developers and designers things will get better. We encourage anyone with an interest in any of these projects to join in the discussion and leave comments below and ask the current developers if they need contributors (I think I already know the answer to that!). I am also sure there are plenty of other CMS systems developed with symfony that have not been released open source and would be nice if companies can contribute back to the community by releasing them into the public. In case we missed something be sure to let us know.
We will review the applications in alphabetical order and will start with Apostrophe developed by the fine folks at P’unk Avenue.
pages: Apostrophe places content in pages. These pages are dynamically created through a nice, clean and concise UI. You can define the template for each page, allowing to have different layouts for your home page, internal and special pages. When you add a page, breadcrumbs, menus and sitemap get updated automatically which can save lots of time and prevent broken links.
slots: A page has areas for content called slots. These slots can contain very diverse data. By default several slot types are provided: rich text, slideshow, video, image, RSS feed, PDF, button, plain text and raw HTML. We will go into more details later on.
media: Out of the box, you get a media manager which allows you to add images, videos and documents into a library that then can be used to locate and link from your pages and slots.
history of changes: when you make a change in a slot, let’s say a rich text, the change gets stored in a history log which can then be accessed for review. You can also revert back to a previous version of the content, which is super-useful. It also works on other slot types, like in the RSS feed it keeps track of the changes in the URL, although it does not show the URL for each revision which would be very handy.
Ajax-enabled UI: The admin elements of the system are displayed and loaded only when you need them. In the demo and installed sandbox, which provides a sample site as starting point, the buttons and menus do not obstruct the general flow of the page, and do not distort the view. It will be interesting to see how it works with other type of sites and more custom CSS layouts.
search-enabled: Apostrophe uses Zend_Search to index content and provide search functionality out of the box. The index is stored in the filesystem by default.
History of changes
Installation
You have a few different options to install Apostrophe: sandbox, svn checkout and plugin installation.
The installation document is very good, with enough explanation for each required step. We picked to download the sandbox tarball, which includes the symfony project skeleton, all the plugins and dependencies needed and a sample site ready to be used. This is probably the quickest way to get started in your own server. It literally took about 5 minutes to download the file, uncompress it, create the needed configuration files (sample files for both config/databases.yml and config/properties.ini are provided), create the database and load the fixtures, and finally run a series of symfony tasks to make sure files can be written by the web server.
Notice the AllowOverride directive in the Directory block. This is very important to make sure the .htaccess file included in the web directory gets used by Apache to assure full functionality of the CMS features.
Then I added the asandbox.local to the /etc/hosts file and restarted Apache.
First impressions
When loading the site for the first time, I got a nice page with some sample content.
Sample site
In the top-right corner there is a Login button. When you click on it a nice login form appears and the default login is admin/demo. Upon logging in, the page refreshes and now you get to see all the admin elements, including a menu on the top of the page which gives you access to configure and add pages, media, reorganize your site structure and manage users and permissions.
Editing a page allows to set basic things like name, access level, template, editing permissions and page engine (more on this later).
Editing page
The media manager allows you to add images from your computer, videos from Youtube and others using embed code, and PDF documents.
Reorganizing the site structure of the site is done by dragging pages in a tree component which is very cool and simple to use. This in turn, updates the breadcrumbs and menus automatically.
Reorganizing site
When you want to add content to a page, you need to add a slot to the section of the page you want. If you need to add some rich text, you use the analogous slot type and a WYSIWYG (FCKeditor) is shown in place. Upon saving, the editor is hidden and the content displayed. If you need to create a slideshow, you add the slot, then select the images from the media library and done! Displaying news from a remote site is super easy, just add a RSS feed slot, enter the URL and see the articles fill up the page. And of course, you can create your own slots.
Help for everybody
The team behind Apostrophe made sure everybody, from developers, editors to designers have at least some kind of documentation to refer to. So if you are a designer and need to customize the layout or work with templates, make sure to read the Designer’s guide. There are also editor’s and developer’s guides.
Installing Apostrophe on shared hosting
Running symfony applications on shared hosting can sometimes be challenging but installing Apostrophe using Maestro can happen in a matter of minutes! There is no doubt we are kicking some hosting butt here. If you want to run Apostrophe on our shared hosting servers, we recommend that you upload the entire project directory (ie. the sandbox directory) into the symfony_projects folder and use Maestro to setup the web server for you. This is a simple process and helps you avoid having to mess with modrewrite rules and so on. Just make sure you do not override the .htaccess file as Apostrophe already provides one for you.
Installing Apostrophe on VPS servers
VPS servers customers have full access to their environment so there are no special steps required if you want to install Apostrophe in a VPS. Just make sure you follow the instructions provided in the installation manual.
Closing notes
A lot of thought, time and effort has been put in Apostrophe. The first stable version was released just before Symfony Live. The system allows you to have a CMS-enabled site running in matter of minutes, which is something most developers of small sites need. Since it is developed on top of symfony and as a plugin, you can use it along other symfony applications and you can extend its functionality to add custom features, a key part of today’s needs.
We want to congratulate and thank P’unk Avenue for releasing this CMS as an open source project. Make sure to follow their blog for updates and if you want to contribute don’t hesitate to join the google group.
A few days have passed since we arrived back in the US after almost a week in Paris, and we are still thinking about what an amazing week it was. We blogged about Symfony Live day 1 last week but day 2 was what many people were really anxious about.
The day started with Lukas Smith’s talk about using the new Symfony components in their own custom framework Okapi. Xavier de Cock’s talk followed, where he displayed a series of good tips on how to get better performance of small sections of code where you would think there is no more room for improvement. These are really useful when your code is iterated several thousands times and beyond, like in his case, an email sender application using SwiftMailer.
Xavier de Cock
The second part of the day was also charged with very interesting talks. Kris Wallsmith talked about deploying Symfony applications to the cloud and he released a very useful plugin for Doctrine to connect to multiple master/slave replicated database servers. Alvaro Videla followed with a fascinating presentation about his experience running and debugging a large site with lots of traffic. They found several areas where Symfony needed some optimizations which now have been added to the latest release. How to make Symfony run faster is always a topic we are interested in. Opening for the main talk of the day, Dustin Whittle from Yahoo explained how they use Symfony in some of their verypopular websites. One of his topics was about deploying Symfony applications, where he spoke about a plugin they developed in-house but could not release due to the many ties with their core business. He mentioned that he wants to form a group to research and develop a plugin or process that will ease the task of deploying apps, which is something we have been thinking for quite some time now, and we look forward to be part of that.
Dusting Whittle talks about the importance of caching.
For most of day 1, the Symfony core team challenged the attendees to submit use cases explaining how Symfony helped businesses and individuals improve their applications and operations. We have been developing with Symfony for a while so we have several examples which we can talk about. We decided to go with writing a use case of our Live Chat system which we use on our site and we were honored to have been selected as one of the top use cases! As we mentioned before, we plan to release this software open source, and with the release of Symfony 2.0 we want to use this opportunity to learn the new framework and showcase its power.
At this point, the conference was already a great success. The attendance surpassed any expectations (aprox 350 attendees), the quality of talks and speakers was superb, the social events around the conference brought together the community in a way I had not seen before. Although we did not get to meet and speak with everybody, we were able to meet with many and this was the most valuable part of the conference. You can look at the slides online, you can watch videos or download code, but meeting the very same people that create, enhance and use the framework is only possible during a conference like this one. May I also add that all this was due to the excellent community growing around Symfony.
Fabien Potencier introduces symfony 2.0
The icing on the cake was when Fabien Potencier presented Symfony 2.0. His presentation was great, you can view the video online thanks to Ben Haines. What he unveiled is a state-of-the-art framework which we think will revolutionize the PHP frameworks’ world. Many of the hard to understand and learn aspects of symfony 1 have been removed or replaced with simpler concepts, “less magic” which tends to also mean “less WTF” problems to quote Jon Wage. With the power of the dependency injection container, Symfony 2.0 can reach speeds other frameworks could only dream of, and coupled with Doctrine 2, developing PHP applications is going to be fun and easier than before.
Some other interesting notes from the conference:
phpBB is considering using Symfony 2.0 for the next version of this super-popular forums software. We were able to meet with Nils Adermann, the new lead developer for phpBB and it looks like he decided to make the switch for all the right reasons. Perhaps we will finally add those forums we keep talking about at ServerGrove.
Symfony 2.0 will use components from Zend Framework, initially Zend_Cache and Zend_Log. This makes total sense as many Symfony developers already use ZF components, it is great that the Symfony core team decided to take advantage of some of the high quality code in ZF and avoid re-invent the wheel.
Symfony 2.0 has a new website, http://symfony-reloaded.org/ with examples, documentation and of course, the source code of a preview release!
One closing note, as you may know, Symfony 2.0 runs only with PHP 5.3 and above. We have already been offering PHP 5.3 on our VPS accounts for many months and we can install symfony 2.0 for you if you want to test drive it, but bear in mind that like Symfony 2 our support for 2.0 is also in alpha but we hope to get up to speed soon enough. That being said, we are very interested in hearing feedback from people who have tested 2.0 on our VPS accounts.
Wow! What a day. Today was the first day of talks for Symfony Live, the first international Symfony conference. Even the organizers were surprised by the turnout, as many people signed up at the last moment, pushing the assistance over 300 people (unofficially). The place was packed and more chairs had to be added to sit everybody.
The day started with an introduction to internationalization support in Symfony by Thomas Rabaix. He was a bit nervous as he was the first speaker of the day, but the content was very good and in the end it was an excellent talk. “Working with the admin generator” by John Cleveley was very well presented including lots of great tips on extending the admin generator and it even included some funny British humor.
After lunch, Dennis Benkert (organizer of Symfony Day in Cologne, Germany) presented a very good introduction to Doctrine migrations, which turned out to be a good appetizer for the main plate, Jonathan Wage’s “Doctrine 2: Not the Same Old PHP ORM”. The title of the talk says it all! Doctrine 2.0 is a full rewrite with new code, new concepts with major performance improvements. We can’t wait to start our next new project so we can use it. Then Stefan Koopmanschap followed with an extensive overview on how you can get help and give back to the community. He listed different resources (mailing lists, forums, symfony website and IRC channels) and encouraged people to organize events and participate in them. The day closed with the whole symfony core team on stage answering all sort of questions by the audience. One interesting topic that we are following closely was brought up by Lukas Smith when he asked the community to step up in producing top-notch web applications with this quality framework. And Fabien was trying hard not to spill the beans about Symfony 2.0 but the crowd was really pulling any kind of tricks to get more details about it.
During the breaks and lunch, we had the opportunity to meet many more symfony developers and clients. If you have not introduced yourself, don’t miss the chance, we may even have some t-shirts left to give out; they are going fast.
Tomorrow is the last day and we can’t wait. Many more exciting talks precede the big announcement: Symfony 2.0. Don’t miss it!
Symfony’s forms are very powerful and big time-savers. Also, thanks for the integration with an ORM like Doctrine or Propel, managing dates is quite easy. But by default, symfony displays date fields as regular select lists where you pick the date (month, day, year, hour, minute)
It is actually quite easy to enhance this functionality and display a friendlier way to pick a date. There are several options at your disposal:
sfFormExtraPlugin
The sfFormExtraPlugin plugin has numerous widgets to improve the appearance and functionality of form input fields. One of them is sfWidgetFormJQueryDate which displays a button next to your field. When clicking on it, a date picker calendar-style pops up.
The sfJQueryUIPlugin plugin is a nicer option. It displays a date picker when you click on the date input field, but it still allows you to modify it manually.
Installation is also quite easy. Install the plugin and add the following to your form configure method:
$this->widgetSchema['publish_at']= new sfWidgetFormDateJQueryUI(array('change_month' => true, 'change_year'=> true));
Today Facebook revealed what they have been working behind the scenes for a long time. In a nutshell, HipHop is aimed at improving PHP’s performance by converting PHP code to C++ and then compiling it with g++, thus allowing Facebook to keep up with their growth with fewer servers.
In theory, by running compiled code, users would get major gains in performance with the same hardware. This is specially true for applications and sites built using frameworks like Symfony, Zend Framework, Cakephp and others. But it also means that you will need to compile the PHP code and upload the result into a server that can understand and run it. In consequence, hosting that will support HipHop be limited.
We have some questions before hand that will get answered pretty soon. How does HipHop compare with running PHP with APC enabled? Since Facebook contributed a lot to APC, we are assuming that using HipHop should be an improvement. We also are very curious to see how it will fare with frameworks like Symfony and Zend Framework.
Here at ServerGrove, our core business is PHP hosting, and as you can imagine that we are very excited about this announcement. As we were one of the first companies to offer PHP 5.3 hosting, we will test HipHop to see what it offers for PHP hosting. Part of our mission is to squeeze every single CPU cycle to offer the best performance from our servers so our customers’ websites run as fast as possible. If HipHop is as good as it sounds, be sure that it will be added to our products offering, but not before making sure we can provide the top-level support that our customers deserve and get from us.
We look forward to hearing your predictions on HipHop. How will symfony and Zend Framework fit in the schema of things? How will this affect our workflow? If HipHop is as good as it sounds, what will be the ultimate hosting product to go with it? Check back soon, as our tests materialize we will post them here.
A problem I have often encountered when working with Symfony projects containing multiple applications is the maintenance of the non-production front controllers. These front controllers contain a default check of the client IP address and must be modified to allow requests from any system except localhost (127.0.0.1). The creator of the application is then left to “roll their own” access control in order to facilitate development while still restricting the world at large.
While this is not a problem for Symfony projects which contain a single application, maintenance of these non-production front controllers can quickly become bothersome as the number of applications in the project grows. Any time an allowed address is added or removed all these front controllers need updated manually.
Listing 1 contains a solution to this problem. The source of the front controllers to be restricted gets replaced with this code (with the proper application name, environment, and debug setting of course). It is assumed the same set of IP addresses will have access to all the front controllers which use this code.
As you can see, the list of allowed addresses is stored in the config/hosts.allow file. This file simply contains an IP address (or partial IP address) to be allowed on each line. A sample hosts.allow file can be found in listing 2.
Listing 2: config/hosts.allow
127.0.0.1
209.85.225.104
192.168.0.
69.147.11.
Problem solved. Now whenever a new IP address or set of addresses needs to be allowed access to your restricted front controllers they simply need added to the hosts.allow file.
It should be noted when matching IP address blocks: since the check uses a substring match on the client address the trailing “.” needs included in the hosts.allow file. Otherwise an allowed address of “69.147.11″ would match “69.147.111″, “69.147.112″, etc.