Last active
March 18, 2017 18:29
-
-
Save peterjmit/5699524 to your computer and use it in GitHub Desktop.
Code snippets for installing Symfony 2 on a Debian VirtualBox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.'); | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd /var/www | |
$ composer create-project symfony/framework-standard-edition my-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.'); | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo nano /etc/php5/cli/php.ini | |
$ sudo nano /etc/php5/apache2/php.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install curl | |
$ curl -sS https://getcomposer.org/installer | php | |
$ sudo mv composer.phar /usr/local/bin/composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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