Skip to content

Instantly share code, notes, and snippets.

View mjavadhpour's full-sized avatar
:octocat:

M.J. mjavadhpour

:octocat:
  • The Earth
View GitHub Profile
Switch PHP version:
From php5.6 to php7.0 :
Apache:
- sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
- update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6 :
Apache:
- sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
@mjavadhpour
mjavadhpour / Symfony
Created December 14, 2016 08:01
Turn on _profiler in server
cut from app/config/config_dev.yml and paste to app/config/config.yml
framework:
...
...
profiler: { only_exceptions: false }
web_profiler:
toolbar: false
intercept_redirects: false
cut from app/config/routing_dev.php and paste to app/config/routing.php
@mjavadhpour
mjavadhpour / symfony_permission.md
Last active December 14, 2017 17:36
Another permission command

Symfony

HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)
setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
@mjavadhpour
mjavadhpour / Symfony
Created December 14, 2016 07:57
Symfony install server
export SYMFONY_ENV=prod
composer install --no-dev --optimize-autoloader
@mjavadhpour
mjavadhpour / Symfony
Created December 14, 2016 07:57
Symfony permission command
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
# if this doesn't work, try adding `-n` option
setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
export SYMFONY_ENV=prod
composer install --no-dev --optimize-autoloader
---------------------------------------------------------------------------------------------------------------------------------
chmod help:
@mjavadhpour
mjavadhpour / Make Swap
Created December 14, 2016 07:53
Create swap file for linux ubuntu
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=10M
Mkswap ~/swapfile.img
add swap line to ======> etc/fstab
swapon ~/swapfile.img
@mjavadhpour
mjavadhpour / php-5.6-repository.md
Last active November 13, 2017 14:17
PHP 5.6 install in linux
$ sudo add-apt-repository ppa:ondrej/php
@mjavadhpour
mjavadhpour / Linux command
Created December 14, 2016 07:46
Linux usefull command
***********************************************************
* *
* Usefull comand *
* *
***********************************************************
php -i | grep php.ini
In ERROR 2002 (HY000):
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
service mysql start or service mysql start