Skip to content

Instantly share code, notes, and snippets.

@peterjmit
Last active March 18, 2017 18:29
Show Gist options
  • Save peterjmit/5699524 to your computer and use it in GitHub Desktop.
Save peterjmit/5699524 to your computer and use it in GitHub Desktop.
Code snippets for installing Symfony 2 on a Debian VirtualBox
<?php
// ...
if (isset($_SERVER['HTTP_CLIENT_IP']) ||
isset($_SERVER['HTTP_X_FORWARDED_FOR']) ||
!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', /* Host machine IP */'10.10.4.1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
// ...
$ cd /var/www
$ composer create-project symfony/framework-standard-edition my-app
<?php
// ...
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
// Host machine IP
'10.10.4.1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
// ...
$ sudo nano /etc/php5/cli/php.ini
$ sudo nano /etc/php5/apache2/php.ini
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
#...
# The entry for our Symfony app
10.0.0.15 local.my-app.com
$ sudo apt-get install curl
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
<VirtualHost *:80>
ServerAdmin you@yoursite.com
ServerName local.my-app.com
DocumentRoot /var/www/my-app/web
<Directory /var/www/my-app/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny allow from all
</Directory>
</VirtualHost>
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/London
; ...
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
$ cd /var/www/my-app
$ php app/check.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment