Store aws beanstalk symfony and apache logs in cloudwatch logs

Do you have a symfony app deployed with autoscale capabilities in aws beanstalk and you don’t have a central logging server? Then you may find this post especially relevant.

When your app scale up and down your server created and destroyed dynamically. During this process you loose your logs. This logs may be extremely useful if something goes wrong in your system. Moreover it may be required by local legislation to keep a copy of it.

This will be a recipe on how to setup Cloudwatch logs as a central log storage in AWS. The example is based on a symfony app but with minor adjustments it will work for any LAMP project.

Continue reading

csvkit and mysql usages

I want to load the following dataset Education statics from the world bank into MySQL to generate some reports without using phpmyadmin.

Let’s introduce this dataset:

The biggest CSV file it is 156MB so I can not use phpmyadmin or MysqlWorkbench another reason to do not use that kind of tools is to be able to automate the process of data loading. I can use mysql LOAD DATA INFILE but then I have to provide the table with the right structure.

In this scenario I choose a python package called csvkit that allow me to transform between different data formats to SQL and insert it into the database. Continue reading

Create your own certificate authority

Why to create your own certificate authority?

Recently I start using my own cloud service storage owncloud to replace dropbox in some scenarios. I wanted to access to my documents throw SSL and for that reason I start checking how to self sign a certificate. Afterwards I realized that I also wanted to protect other websites with my SSL and I decided to create my own Certificate Authority CA. The main reason to create the Certificate Authority is to have only one certificate to install on my devices instead of each of the multiple certificates. Continue reading

How to XDebug PHP on production or a remote application

Does you ever had an issue that only appears on production environment? Have you ever felt how easy could be to solve an issue if you can debug the live system instead of the localhost that just works fine?

Debugging a live system can be scary, but it is not if you follow the right steps. Follow this How to XDebug PHP on production and please comment. Continue reading

XDebug and PHP setup for Mac OSX

Debugging PHP it shouldn’t be painful. XDebug it’s a fantastic PHP extension that provide debugging capabilities. The setup procedure it is easy and it already comes ready to go on XAMP and WAMP.

Let’s start for the mistake when someone try to “debug” a code for the first time. When you are digging into unknown behavior in your code you are running web server while you edit your code and press F5 compulsively. Add a die there, var_dump there and see if there is what you expect until you found something unexpected and start following that clue again. Continue reading