Customize Symfony for development environment

When you use a development environment similar to the production, you can’t use the app_dev.php as given. With vagrant your front IP could be 192.168.33.10 With docker you can define a front IP as 172.10.0.1 So open app_dev.php and change the following code if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1', '192.168.33.10', '172.10.0.1'], true) || PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } Keep in mind, always use private IP and don’t include this file during deployment to your production ...

July 14, 2017 · 1 min · 94 words · oxomichael

Symfony basic start

Basic start of a symfony project (version 3.x) Create your project $ composer create-project symfony/framework-standard-edition my_project_name If you want to use an LTS version you can specify a version. $ composer create-project symfony/framework-standard-edition my_project_name "2.8.*" Use Git to store your project You can see a .gitignore file, open it to see which files of your project is ignore. Simply use these commands to make your initial commit git init git add . git commit -m "Initial commit" Apache with PHP-FPM ### Sample configuration ...

July 5, 2017 · 3 min · 508 words · oxomichael

Create a vagrant box from scratch

Box Debian Stretch 64 Install VirtualBox Install Vagrant Download the debian net install CD Create virtual machine Virtual Machine Hardware Name: vagrant-stetch64 Type: Linux Version: vagrant-stretch64 Memory Size : 512MB New Virtual Disk: Type: VMDK Size: 8GB Disable audio DIsable USB Mount ISO CD Installation Choose Graphical Install Select a language Select your location Configure locales Configure the keyboard Configure the network Hostname : stretch64 Set up users and passwords Enter “vagrant” as root password Enter “vagrant” as fullname New user as “vagrant” and also “vagrant” as password Configure the clock Partition disks Guided - use entire disks Just let SCSIl (0, 0, 0) (sda) - 8.6 GB ATA VBOX HARDDISK as preselected and continue. All files in one partition Let’s Finish partitioning and write changes to disk. Install the base system Configure the package manager Software select Please disable every option, except standard system utilities. Finish installation Configuration Install sudo $ su ...

June 30, 2017 · 2 min · 328 words · oxomichael

PHP : Composer in docker

Si vous développer en PHP avec tout votre environnement local de développement en docker, alors vous voudriez bien aussi utilisez les bonnes pratiques de docker et placer Composer dans un container. Pour ce faire, il existe donc l’image officiel de Composer sur le hub de docker. Voilà comment, je l’utilise : docker pull composer Ce container sera utilisé en lancement au premier plan et supprimer ensuite, il est inutile de laisser tourner ce container. ...

June 16, 2017 · 1 min · 190 words · oxomichael

Apache2, PHP-FPM

A partir d’Apache version 2.4.10, il est possible d’avoir des performances identiques à NGINX. Principalement en utilisant php-fpm avec le mod_fcgi. Avec Ubuntu 14.04 Tout d’abord activer trusty-backports dans /etc/apt/source.list, puis autoriser les paquets backports en priorité dans le fichier /etc/apt/preferences Package: * Pin: release a=trusty-backports Pin-Priority: 500 Ensuite exécuter $ apt-get update && apt-get upgrade Vérifier que Apache 2.4.10 est bien installé $ apt-get install apache2 Installer php-fpm (php5-fpm ou php-7.0-fpm) ...

June 28, 2016 · 2 min · 400 words · oxomichael

Install Eclipse on Ubuntu

Eclipse OXYGEN Download the new oomph installer. Install in your home Create a desktop entry with Icon $ gedit .local/share/applications/eclipse.desktop [Desktop Entry] Name=Eclipse Type=Application Exec=/home/USERNAME/eclipse/eclipse Terminal=false Icon=/home/USERNAME/eclipse/icon.xpm Comment=Integrated Development Environment NoDisplay=false Categories=Development;IDE; Name[en]=Eclipse Name[fr]=Eclipse Eclipse Mars.2 Uncompress the Eclipse archive in your home Edit eclipse.ini File -startup plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.300.v20150602-1417 -product org.eclipse.epp.package.php.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.GTK_version 2 --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m

May 12, 2016 · 1 min · 67 words · oxomichael

Linux et USB3, Désactiver le protocol UASP

Après avoir acheter un joli ICY DOCK Black Vortex (MB174SU3S-4SB) pour pouvoir mettre 4 disques pour faire des sauvegardes, l’utilisation de rsync intensif provoque des ralentissements/déconnexion. Un petit tour avec DMESG est on remarque plein d’erreur. Petite analyse, le disque est branché en USB3 donc $ lusb Bus 006 Device 002: ID 152d:0567 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge $ lusb -t Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M Nous allons donc désactiver l’utilisation du driver uas afin de repasser sur l’usb-storage ...

March 2, 2016 · 1 min · 154 words · oxomichael

Migrate Git to another Git

… or how to make a backup. All is simple Tout est très simple Clone your project in a local directory $ git clone --bare oldserver/repo.git Enter in the directory created by the clone operation $ cd *repo.git* Push your entire project as a mirror in your new server $ git push --mirror newserver/user/repo.git Voilà.

February 4, 2016 · 1 min · 55 words · oxomichael

Migration SVN vers Git

Afin d’améliorer le processus de mise production, pour mon usage, il est intéressant de passer tous les projets sur Git. Bon on va commencer par consulter la doc officielle, https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git ou pour la v1 (https://git-scm.com/book/en/v1/Git-and-Other-Systems-Migrating-to-Git) Voici donc les différentes étapes pour migrer un projet de Subversion vers Git Créer un fichier $ svn log [PATH] --xml | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' > users.txt Modifier le fichier pour obtenir sur chaque pseudo quelque chose de cohérent pout Git pseudo = prénom nom Cloner le projet SVN à partir de git-svn $ git svn clone --prefix=origin/ --stdlayout http://[PATH SVN DU PROJET] --authors-file=users.txt --no-metadata -s [PROJET] Cette opération va créer un repository local Git ...

January 23, 2016 · 2 min · 281 words · oxomichael

Composer and Zend Framework version 1

Define your apps for autoloading You’re still working with Zend Framework 1 (and yes, still apps running without you being able to make an evolution), so here’s a small example of use. First, create your file composer.json { "name": "company/projet", "description": "ma description", "require": { "zendframework/zendframework1": "^1.12" }, "autoload": { "classmap": [ "application/", "library/Application/", ] }, } Use the require and classmap option to create our autoload (again we have an old application). See the composer documentation to add more configuration options (http://getcomposer.org). ...

September 25, 2015 · 2 min · 233 words · oxomichael