$ sudo add-apt-repository ppa:ondrej/php
This file contains hidden or 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
*********************************************************** | |
* * | |
* 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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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: |
This file contains hidden or 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
export SYMFONY_ENV=prod | |
composer install --no-dev --optimize-autoloader |
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 {} \;
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
Today I got again problem with PHP 7 running despite I have disabled php7.0 apache module: phpinfo was showing php 7 using fastCGI ... | |
... So if after you follow the below instructions you face this situation, you may need to disable the proxy_fcgi apache module: | |
sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart | |
1. Re-Install PHP 5.6 | |
What worked for me was this guide: http://www.lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu | |
Actually is not required to remove php7.0, you can install php5.6 together ( also because you will have dependency problem with phpmyadmin package that required php7.0) |
This file contains hidden or 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
You should never have to run a website out of your home directory. EVER. You would otherwise have to give the web server the ability to traverse through /home/ to see the directory structure, but also into /home/$USER/ (your user's home directory, where we can try and see what else exists in your user directory), as well as any other subfolders in there. A poorly-configured or misconfigured or unpatched web server can cause massive data leakage this way, or loss of credentials and such which would put your personal data and logins on different things at risk. The symlink approach you are using doesn't help either for the same reason as trying to give Apache permissions to read /home/andre/www/moodle - the web server has to be able to traverse your home directory to get to the location that the symlink in /var/www/html points to, which still poses that security risk. | |
Firstly, use sudo cp -r /home/andre/www/moodle/ /var/www/html/. This will copy your files to /var/www/html, and keep it away from your own home |
OlderNewer