Simple open-source-CMS working with hiphop php? - php

Hiphop from Facebook don't like eval() or create_function().
Are there good open source php-CMS which work with hiphop almost out of the box?
Drupal is not compatible as far as I know.
If possible, are those cms multi-site-enabled (one code base hosts several sites with different db-connection-strings).
I think that hiphop php could be a good choice for Amazon EC2 it could save a lot of money.
Thanks in advance,
Tom

Back in 2009, PHP creator Rasmus Lerdorf made a presentation for the Digg folks, in which he demonstrated numerous performance profiling techniques. It takes 20 slides to get there, but he demonstrated that conventional performance profiling techniques can be just as effective at increasing performance as HipHop.
Forget HipHop. Profile your code to identify bottlenecks, then remove them.

Related

Writing windows applications in php example

I recently discovered that it is possible to write windows applications in php. Can someone provide a link to an windows (windows 7) application written in php so I can install and run. I am still kind of sceptical that this is possible. Seeing is believing
Edit There are a lot of broken links on the apps page of the phpgtk community site mentioned in a couple of answers. I am looking for an exe that I can download and install to prove to me that it is possible(and practical). A lot of the applications on the phpgtk site are a bit of a joke(tick tac toe, click a button as fast as you can etc), are there any serious desktop applications being written in php or should I just give up on the idea now and pursue c++ for desktop applications?
As far as I know, PHP-GTK is sort of dead, or at least very inactive. Not that it ever had a very active community anyway ...
There are also a few other PHP GUI projects out there, personally I wouldn't use any of them, for the simple reason that IMHO PHP is lacking features to write serious GUI applications, the biggest is probably the lack of threads, or any other serious multi-processing capabilities for that matter...
There is pcntl_fork(), which works (used it a few times), but it has the major the drawback that it doesn't work on Windows. One might also argue that using fork()is inferior to using threads, but that's a different discussion.
Especially with a GUI you'll probably want some sort of threading support, let's say your GUI is doing some operation that'll take 20 second (copy files, download something, etc.), you typically don't want the user interface to freeze while this operation to happen, and you may also want to run multiple operations at the same time.
I'm not sure how PHP-GTK solves these problems, if they solve them at all, but lack of real built-in language support would still cripple you.
There are also other drawbacks to PHP, but those are more general, although you will probably run into them sooner on desktop apps than on web applications (for example, error handling, OS portability, proper UTF-8 support, etc.).
There are many other programming languages which are much better suited for this particular job, and most of them have the advantage of having a (much) larger community than PHP-GTK, which means more docs, more example, more people to ask for help, etc.
C++ might be a good choice, Python, Perl, Ruby, C#, etc, etc. can also be considered. Wikipedia has an extensive list: http://en.wikipedia.org/wiki/Comparison_of_programming_languages
My advice: Choose one that looks Ok and meets your needs, and start hacking. If you don't like it, try something else. ;)
WinBinder is an open source extension for PHP, the script programming language. It allows PHP programmers to easily build native Windows applications.
This should be what you are looking for :)
http://php-gtk.eu/en/apps
there is an awesome extension called WinBinder, I used to work on it. its very easy and straightforward... here is what you can do with it VBM2 sample
also there is PHP-GTK which is a bit hard to learn for people who didn't code Desktop Apps before. however, PHP-GTK is powerful and has better support and you can develop apps on cross-platforms.

Facebook HipHop virtual machine for PHP?

I've looked at this article- HipHop PHP (was Hyper PHP by Facebook)
However, recently come across this Facebook Speeds Development With “HipHop Virtual Machine”, A 60% Faster PHP Executor
Does anyone have details on this? Is it worth exploring for a PHP developer?
You can find the details in the article linked in the article you linked:
https://www.facebook.com/notes/facebook-engineering/the-hiphop-virtual-machine/10150415177928920
hphpc is in essence a traditional static compiler that converts PHP→AST→C++→x64. We have long been keenly aware of the limitations to static analysis imposed by such a dynamic language as PHP, not to mention the risks inherent in developing software with hphpi and deploying with hphpc. Our experiences with hphpc led us to start experimenting with dynamic translation to native machine code, also known as just-in-time (JIT) compilation. A dynamic translator can observe data types as the program executes, and generate type-specialized machine code.
The type-specialized machine code runs faster. Unless you are the size of FB, you do not need this. Use APC or memcached and more traditional approaches to scaling out.
The other answer about HPHPC is accurate... the performance boost is quite nice, but only if you actually need it enough that it's worth the extra complexity.
I'd suggest waiting a few weeks or even months before looking into HPHPVM. It's looking promising, but it's still in the very early stages as far as optimization and bug-fixing go. In the long run it'll probably end up being a great alternative to Zend, but right now the relatively small boost in performance (compared to, say, full translated/compiled HipHop) is likely not worth the extra complexity. That said, do check back in a few months.

Can I use Facebook's hiphop with frameworks like Zend Framework, cakephp, symfony

Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php functions and constructions is more limited than in standard php.
Are the current popular php frameworks (ZF, CakePHP, symfony) compatible with HipHop? If not, which parts of these frameworks are not usable?
If I'm not mistaken, HipHop has not been released yet -- even the wiki page linked from the Facebook annoucement yesterday is not up yet.
So, it's going to be a bit hard to answer, right now.
I suppose it'll all depend on :
The features used by the Frameworks -- like already said here and there, stuff like eval is not supported by HipHop
The PHP extensions used by the Frameworks : only a couple of those have been ported by Facebook to HipHop.
Depending on the Frameworks and your specific needs, maybe/probably some subsets of the Frameworks you are using will be supported, even if not every available components... I suppose time will tell which ;-)
With at least ZF and Symfony being used for Enterprise level applications, chances are pretty good they will run with HipHop. If not now, then sooner or later. However, the question is not so much if they can run with these frameworks, but how your supporting IT architecture looks like.
HipHop is for scaling large multiserver high traffic sites like Facebook. In your regular web application, you will likely get no advantage out of it. Just continue to use memcache and APC.
See these related articles:
http://www.readwriteweb.com/archives/rasmus-lerdorf-php-hiphop-facebook.php
http://ilia.ws/archives/213-My-Thoughts-on-HipHop.html
http://terrychay.com/article/hiphop-for-faster-php.shtml
http://www.brandonsavage.net/hiphop-for-php-who-benefits-who-doesnt/
While I'm sure most of us are curious about what HipHop is going to be, I know it will not be a replacement for PHP - it's very much a niche product: unless you're running a large server farm then the performance benefits vs the maintenance costs just wouldn't justify it.
Perhaps it might be an interesting alternative to use encoded PHP for some people - but again this introduces even greater maintenance overheads. The only low-volume scenario where a compiled PHP would seem to make a lot of sense is for embedded devices (where the software exists to support the hardware and not vice versa) and for very high security installations (where its not a good idea to have a interpreter available).
It's far to early to be able to say what PHP software will work with it. However even once thats established, I'd want to see a solid commitment from any supplier that they were going to explicitly support HipHop in the future before I switched.
C.
I won't repeat what has already been said, I'll just add that as soon as HipHop is released you can count on the opensource community to submit patches for your favorite framework for increased compatibility with HipHop.
Also, one good way to test whether your favorite framework is compatible or not would be to launch the test suite using HPHPi (you then know where to concentrate your patching effort ;).
Searching for 'eval' gives a lot of false positives, as you get hits for the word "evaluate" in comments, or escapeValue if the search isn't case sensitive, etc.
If you search for 'eval(' in ZF 1.11 you'll find in once in Zend/Serializer/Adapter/PhpCode.php on line 59, in a method that unserializes stored PHP code. The method isn't a part of the MVC architecture, db component, and actually isn't used anywhere else in the framework (Zend_Serializer_Adapter_PhpCode isn't instantiated anywhere else in the code base).
So if eval breaks your ZF-Hip Hop app, don't use Zend_Serializer_Adapter_PhpCode, or eval in your consumer code.
Simple answer: I don't think it would.
Just saw this on hiphop page: https://github.com/facebook/hiphop-php/wiki/
"You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features – such as eval() – in exchange for improved performance."
Did a search for 'eval' on ZF 1.9 and there are over 100 occurrences.

To ColdFusion (from PHP) for Flex/Flash backend? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm starting to learn about Flex/Flash and come from a PHP background. It seems that ColdFusion has been the language of choice for Flash/Flex backend. But (the big but for me) I don't plan to build websites that will heavily depend on Flash (for SEO etc.), just websites that will incorporate Flash in small parts of them. I'm thinking for this reason, I'm not going to gain any advantage switching my backend work from PHP to ColdFusion. Since I'm new to the technologies, I'm not sure if that's the right thinking though. Can someone help out comparing PHP vs. ColdFusion (which I'm assuming is Adobe's favorite backend language)? in the context of what I said above would be helpful too. Am I going to be losing a lot of libraries, functionality, convenience, etc. by not doing my backend stuff in ColdFusion.
FWIW. Flash Remoting (AMF) in ColdFusion is much faster than the PHP alternatives. On the magnitude of 40x faster! If performance matters, then ColdFusion is really the only choice.
I have used both CF and PHP for a similar purpose: to execute database queries in the backend from a flash movie front end. These flash movies were, similar to your situation, more or less standalone, not heavily integrated into the website
I found that there is not much that you can acheive with CF that you can with PHP. Database operations are a tad easier to accomplish in CF than PHP, and that's about it. However, if your SQL skills aren't too shabby, this is not much of an issue.
IMHO, your needs are better suited by PHP because it's free, and you can get a WAMP or LAMP rig easily set up as your sandbox. If you just want a sandbox for CF, you either have to pay the sticker price* for the official Adobe software, or get vastly inferior imitations available, such as Railo Server.
Do note that for me, I was able to accomplish database operations on the backend using WAMP/LAMP and Adobe CF, but not with Railo, so that greatly limits your sandboxing experiments with CF. This was 9 months ago though, so you may want to check if Railo has improved since.
As for libraries, there are many more out there available for PHP than CF, due to a much larger developer community. Evidence from Google:
PHP : 15 million hits
CF : 0.5 million hits
In summary: go with PHP.
HTH
Edit:
As mentioned by Al, CF developer's edition is free.
I as well as many others wrote a length answers to ColdFusion Vs PHP which may provide a greater language comparison.
If you only doing small tasks you can stick with HTTP and XML data transfer on the flash side. Unless your moving a lot of data you won't see a great benefit from the AMF ( Adobe Messaging Format ). If you need such binary data transfer PHPAMF is available as is Adobe's open source BlazeDS which comes with ColdFusion and is available separately.
I personally feel you should stick with what ever tool is more comfortable to you. But don't be confused by those who treat ColdFusion as inferior. ColdFusion is a java application as such if you can pull in any and all of the vast java libraries available. Java has more libraries than ANY language even the coveted PHP. Also for development Adobe's ColdFusion is free and well as Railo's Open source offering which bundles with Blaze DS the same open source Java/AMF server that ColdFusion 9 comes with. I personally use Railo and BlazeDs with great success as free open source CFML options.
A few thoughts on the matter, from someone who has developed in both PHP and ColdFusion
ColdFusion has better OO support than PHP5 (or maybe I'm just doing PHP5 OO wrong)
ColdFusion works better with a wide variety of other technologies (Flash/AMF, Databases, LDAP, .NET, Outlook, SMS, SOAP, JSON etc..) out of the box with no addons.
PHP has a smaller memory footprint
PHP is more easily available from shared hosting providers
Having said all of that, if you're looking at building small addons to your website using Flash/Flex there's no reason why you should feel obligated to learn a new language, and redo the rest of your site into CF. PHP will work fine. If you're solely a PHP developer, and you've already got experience with PHP, it might be worthwhile to pick up CFML as a side language, just to open up contracting opportunities, and broaden your horizons, but it's probably not worth it if you're just trying to get this project done quickly, and "the right way"
I'd just like to add another vote for the "Stick with PHP" bandwagon (from an active Coldfusion developer):
PHP is free and has great resources and a good community.
Coldfusion has an ever-decreasing community.
Syntax wise, Coldfusion is an eyesore.
Although Adobe makes both Coldfusion and Flash/Flex, I've found that the advantages to using Coldfusion over PHP for Flash/Flex support are minimal.
As bguiz said, Coldfusion has better support for databases. Specifically, switching from one database to another is easy and painfree. However, once again, the advantages over PHP are minimal.
PHP has full OO support, and support for closures and other helpful functionality.
Learning PHP and using PHP will help you in the future. Learning Coldfusion will (more than likely) make you regret learning Coldfusion.
To me, they are both viable, good options. This isn't necessarily an easy choice, as each language has it's own strengths and weaknesses. Having used both extensively, however, I have to give PHP the edge.
IMO, based on what you're saying (the projects your working on integrating flash and flex with right now only make use of these technologies in small and limited scopes), you'd be insane to switch to CF. That's far too much misery and grief for next to no gain.
That being said, if you ever intend on broadening your scope of usage with these products, you should at the very least concurrently pick up some CF knowledge. If either of these technologies are going to be a significant part of your future development plans, you'll need a knowledge of Coldfusion to determine if switching to Coldfusion is going to provide you with significant ease-of-integration and/or performance benefits.
Unfortunately, there isn't a good online source that can hand-hold you while you learn Coldfusion (like the hundreds that exist for PHP); But finding a Volume 1 for the Coldfusion Web Application Construction Kit (WACK) for either 7 or 8 can give you a good foundation to build on (while I don't know about the CF7 WACK, the Flash and Flex integration are covered in depth in Volume 2 of CF8's WACK; but you'll still need to understand the basics before reviewing that).

Starting out doing server side things - what languages and techniques to choose?

I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my ignorance on server side programming.
So, what do I need. I need to get my head around how to use databases and how to use some server side programming language, I guess. What is the right choice? What should I avoid?
Thanks.
PHP and MySQL have a pretty low barrier to entry (they're both free and ubiquitous). I'd start with those, since most hosts provide them for you. As an added bonus, they work really well together (and PHP isn't very hard to learn coming from a web development background).
Head First SQL is a great book for learning MySQL. All of the examples in the book are done on MySQL. The book even explains where to get it and how to install it. As for PHP, the introductory tutorial at official website is the best place to learn it.
Update: Head First PHP & MySQL is now available. I haven't read this one yet, but other books in the series and by the same author are great for learning new languages from scratch.
Download Python. Learn the Python language. Learn Object-Oriented programming.
Python includes SQLite, this makes it easier to Learn the SQL language.
Download the Django framework. This makes it easy to write server-side applications that work simply and reliably.
I would suggest PHP. Not because it's the best, most modern or cleanest language out there, but because it is easy to learn for someone coming from pure HTML.
You begin by just adding tiny bits of PHP to your regular HTML and magic happens :)
Ruby is a fantastic language and the frameworks for web stuff generally teach you some good practices. Try it. The Learn to program book uses Ruby, maybe you'd like to check it out.
I noticed in your question you mention that you've been using javascript. If you're comfortable progamming javascript, I've recently begun working with server side javascript in the form of EJScript on linux and using jscript on windows. It's been fairly painless, and the documentation has been pretty good so far on both.
If you're more interested in learning this with another technology then Django & Python or ASP.NET & C# (or IronPython) are both fairly low barrier to entry platforms available on windows, *nix, etc...
I would say that if you're comfortable working in Linux, then go for PHP and MySQL. If you aren't comfortable working in Linux, then download the free Visual Web Developer version of Visual Studio Express, and get started using that. This lets you program in VB.Net or C#, and use the .Net web development framework. It's really miles ahead of anything PHP in terms of how nice a platform it is to work on. There's also a free developer edition of SQL Server that lets you store up to 4 GB of data.
There's plenty of .Net hosts out there now too. Although, due to increased license costs, Windows hosting plans will usually cost more and give you less space/bandwidth than Linux hosting plans, you can still get enough room to play around with and deploy some apps on the web. If you develop something really cool, and outgrow what your hosting account provides, it's probably time to upgrade to a VPS, and post ads on your site to start paying the bills
I'd recommend PHP for folks who are familiar with HTML but are newish to programming. Here's why:
I'm currently an ASP.Net developer, and I think that ASP.Net abstracts waaaaay to much to make it a good first programming environment. I say learn how to generate and manipulate straight HTML with a language like PHP instead of trying to understand GridViews, etc., which have no bearing or relevance to programming in the broader sense.
I wouldn't say ASP.Net is "the Dark Path" or anything, but if you start out by learning it, you'll tend to favor the warm and insulating arms of the framework. ASP.Net is pretty much a code-generator when compared to more explicit (some would say reckless, messy, and tedious, but I'm not one of them) methods like PHP.
With PHP you'll see the effect your code has on the actual HTML when you view source. With an ASP.Net page, you'll be baffled by the amount and complexity of the HTML it spits out.
After you get your hands dirty in PHP, you can explore the pros and cons of frameworks like ASP.Net that "do a lot of the work for you".
I was exactly in your situation 3 to 4 years ago and, like some of the commentators suggest, I tried PHP because of its low barrier of entry.
That was a mistake! Oh sure I was able to achieve some things here and there, including using a contact form from a book which was so flawed that it was later hijacked by big time spammers and got my domain banned from most email servers out there.
Later on I tried to learn how to create dotabase driven sites with object oriented programming following the guidance of the excellent books, blog posts, and forums from Sitepoint and other sources. It was just too hard for my little brain. I just could not do it.
So what happened? 2 1/2 years ago I decided to learn Rails, which had just turned v. 1.1. It has been fun since the beginning and extremely rewarding. Working with Ruby is a pleasure, much easier to learn than PHP, and the Rails framework is so well put together that you can, with little effort, produce some very elaborate web sites with advanced features all while learning how to do proper object oriented web programming.
I used my new knowledge to recreate from scratch the site of my non-profit organization (with a new domain ;-) and, with a friend who is a talented designer, created a web development firm.
Don't get me wrong, it's not that easy, if you want to learn programming you need to put a lot of effort into it but in my own experience Rails can bring you some instant results while letting you get deeper and deeper over time.
I recommend two main sources of knowledge:
The excellent, official Rails
guides.
The free screencasts
from Railscasts.
Whatever your choice will be I wish you the best and a fun and fulfilling experience
I recently came upon this question myself. I really liked the way PHP integrates with HTML making designing a site more natural in my opinion. Design your site as you would with static content and then switch the static with the dynamic. However, I wanted to choose a "good" language. I looked at PHP, Ruby, Perl, and Python, as they are the most popular, open source options. I didn't need any powerhorses, if you will, like Ruby on Rails or Django, since I just wanted to mess around with server side stuff and some SQL—nothing serious. I don't remember why nor do I care to remember why, but I chose Python. But I still wanted that integration with HTML. I came across Karrigell. It's a neat piece of Python that essentially handles the integration. It comes with a little web server which you can use on its own or use something like mod_proxy with lighttpd. The devs don't limit you to only Python inside HTML, though. Their server parses: Python inside HTML, HTML inside Python, plain ol' Python scripts, and Karrigell services. It may not integrate as well as PHP does, but it's pretty damn good.

Categories