Wednesday, September 30, 2015

Print a custom static fivestar widget with fivestar module

$star = 80;
$star_display =  theme('fivestar_static', array('rating' => $star,'stars' => 5));
print render($star_display);

Tuesday, September 15, 2015

Install PHP, Apache, MySQL, PhpMyAdmin On Ubuntu


sudo apt-get update
sudo apt-get upgrade (optional)

MySQL
=====
sudo apt-get install mysql-server mysql-client

Apache

=====
sudo apt-get install apache2

PHP
===
sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Restart Apache
===========
/etc/init.d/apache2 restart

PHPMyAdmin
==========
sudo apt-get install phpmyadmin

I don’t like to use Apache’s default http folder /var/www so I need to update the apache2.conf file:
sudo gedit /etc/apache2/apache2.conf

Changing the default location will require me to make sure phpMyAdmin continues to load on http://localhost/phpMyAdmin so at the end of the same file I ll add the virtual host configuration for phpMyAdmin
Include /etc/phpmyadmin/apache.conf

Restart Apache   
===========
/etc/init.d/apache2 restart

------------------------------------------------------------------------------------------------------------------------------------

Increase Upload Max File size and other configurations

sudo gedit /etc/php5/apache2/php.ini
upload_max_filesize 2M
sudo /etc/init.d/apache2 restart

------------------------------------------------------------------------------------------------------------------------------------

Clean URLs with Apache 2 on Ubuntu

sudo a2enmod rewrite
sudo apache2ctl -M

If you are running Ubuntu 14.04+:
sudo gedit /etc/apache2/apache2.conf
Otherwise:
sudo gedit /etc/apache2/sites-available/default

AllowOverride None to AllowOverride All
sudo /etc/init.d/apache2 reload

------------------------------------------------------------------------------------------------------------------------------------

Enable Curl

sudo apt-get install php5-curl & sudo /etc/init.d/apache2 restart

------------------------------------------------------------------------------------------------------------------------------------