If you want to deploy Symfony app using Capistrano 3 to cheap OVH VPS then you’ll need to write a simple task to set proper permissions.
Edit: unfortunately, there was still a little problem with permissions and I made deployment semi-automatic.
I have a very cheap VPS in OVH, it costs only about $2 per month. It is perfect for my needs, I have my blog there, I have my friend’s blog as well. And now I want to move my wife’s portfolio from (even cheaper :P) shared hosting to this VPS.
Until now deploy to shared hosting looked like this:
- open FTP
- go to portfolio directory
- move changed files
- app/console cache:clear
Fortunately, I had access to SSH on my hosting (not popular thing) so I could try to automate this process a little bit. But because I already have VPS then the better idea was to move the portfolio there and use some tool for deployment.
The portfolio is written using Symfony 2 framework so the best idea is to use Capistrano. I had some experience with Capifony which is pretty old, unmaintained customization for Capistrano 2 (which is also quite old). I don’t want to use old stuff. So the goal is easy: deploy Symfony 2 app using Capistrano 3 to OVH, cheap VPS.
If you’re writing commands in Symfony then you probably know the ProgressBar component. It’s useful tool showing the current state of operations and, more importantly, ETA and used memory. Cool.
If you’ll to the official ProgressBar component page then at the beginning you’ll see a very cool progress bar, with colors, icons, changing status messages, but… If you’ll look a little further you’ll see a sad, black and white progress bar, that is far from a “promise” made at the beginning 🙁
Heads up! We’ll make it like this 🙂
I wanted to write a manual about installing PHP5.6 and PHP7.1 at the same time, on OS X, using homebrew instead of using Docker (which I find not the best idea on OS X, but maybe I’m wrong?). But someone did it before me 🙂
If you want to have many PHP versions simultaneously then follow the instructions described by Jani Tarvainen on Symfony Finland blog: https://symfony.fi/page/how-to-run-both-php-5-6-and-php-7-x-with-homebrew-on-os-x-with-php-fpm and enjoy native, fast and simple way to work on crappy old projects in PHP5.x and new, shiny ones in 7.1 😛
This is a simple tutorial how to set up Selenium test with PHPUnit and phantomjs for easy and fast testing.
Today I wanted to learn something about Selenium. It’s very popular testing tool for any application that can be launched using a web browser, regardless of programming language or technology. I don’t know it very much, in fact, I know only how to set it up and write the simplest test 😉 But I want to share my today’s experiences because I cannot find any simple tutorial and had to glue together scripts, setting and libraries from all across the internet 😉
If you don’t like reading tutorials and want rather dig into example code I created the repository on GitHub where you can find everything I talk about here.
This blog post will contain useful information for those, who want to start developing in Symfony without setting up a server (like apache or nginx) or installing docker.
PHP from version 5.4 has built in server. You can run it by executing in console
php -S 127.0.0.1:8000 in your projects directory. When you go to this address (of course you can change the port and 127.0.0.1 to localhost) you’ll see the main page of your project.
I was challenged in my last post to deeper check performance of strings. I think it will be quite interesting to test out some cases and say which way of using strings is the best.
In this post, I will check several string usages in PHP 5.6 and PHP 7.
To simplify testing I created a simple function which gets 2 arguments: an array of callable functions to compare (as many as you want) with names to display in summary, and a number of loops to test the function…
As you may know, in PHP you can use single and double quotes for strings. These two lines are equal:
$str1 = "some string";
$str2 = 'some string';
// $str1 === $str2 returns true
The only difference here is handling variables placed inside quotes. Let’s look at this simple example:
$name = "John";
$str1 = "Hello there $name";
$str2 = 'Hello there $name';
echo $str1; // gives Hello there John
echo $str2; // gives Hello there $name
As you can see in double quotes variables are processed and in single quotes they aren’t.
But which one should I use?
php -a command opens interactive shell in which you can write some simple samples of code and quickly validate some of your ideas. It works like Python shell and you can write in it simple statements, functions and so on.
I was working on a project in C# and ASP.NET MVC once. It was a long time ago. I can remember how happy I was. Earlier I was creating a project in PHP in the worst way: on an own framework. It was all old, shitty PHP. With big routing arrays, custom validation services, and ancient template engine, Smarty2.
When I started to create a project in ASP.NET I was astonished how many great features it has. One of them were annotations.
Time to speed the things up!
The series becomes a little too long, so its time to the drastic movement.
The application is working now. Here I’ll describe how to add a new note and set reminder as done. I think, that this will be a good foundation for extending the application.