Let’s see how to install Adobe Flash under Ubuntu for Firefox properly.
Visit the official site (http://get.adobe.com/flashplayer/) and download the
.tar.gz file. Create a temporary directory (e.g.
/tmp/flash) and save the file there. This archive is a tarbomb, that’s why we put it in a dedicated folder.
Unzip the archive. There is a “
usr” subfolder whose owner and group must be set before copying it to “
/usr“. Switch to root (with “
su“) and perform the following actions:
chown -R root:root usr(where “
usr” is the subfolder from the archive, not the system folder)
- copy this “
usr” folder to “
/usr“, i.e. copy it to the system folder
(Of course, you can also do these steps with “
Finally, copy the file “
libflashplayer.so” to the directory “
$HOME/.mozilla/plugins/“. It’s very likely that this folder doesn’t exist yet so create it first.
Restart Firefox and enjoy the ultimate Flash experience :)
“JpGraph is an Object-Oriented Graph creating library for PHP >= 5.1 The library is completely written in PHP and ready to be used in any PHP scripts (both CGI/APXS/CLI versions of PHP are supported).“
If you want to draw graphs in PHP, JpGraph is a good choice. Very easy to use yet powerful.
Here I suppose you have a
public_html directory in your HOME and your PHP scripts are in
Download the latest jpgraph archive, put it in
~/public_html/lib and extract it. Now you will have a directory like
~/public_html/lib/jpgraph-3.5.0b1. Put a symbolic link on it with a simpler name:
cd ~/public_html/lib ln -s jpgraph-3.5.0b1 jpgraph
Verify if the directory jpgraph has the correct permissions. Directories must be 755, while files must be 644. To correct permissions, you can use this script:
#!/bin/bash # setjog_here.sh # # place it in ~/public_html/lib/jpgraph and launch it # it'll set the permissions recursively find . -type d -print0 | xargs -0 chmod 755 find . -type f -print0 | xargs -0 chmod 644 chmod 755 . chmod u+x $0
Test an example
~/public_html. Modify the include lines:
# original: #require_once ('jpgraph/jpgraph.php'); #require_once ('jpgraph/jpgraph_line.php'); # new: require_once ('lib/jpgraph/src/jpgraph.php'); require_once ('lib/jpgraph/src/jpgraph_line.php');
Now call this file from your browser. The URL must be similar to this: http://localhost/~jabba/example0.php.
You might get an error saying “The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.“
Don’t worry. Open the file
~/public_html/lib/jpgraph/src/gd_image.inc.php, find the function
SetAntiAliasing and comment this line out like this:
// JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
Update (20110215): Comment out just this line, not the whole function :)
This is a quick fix; we disabled antialiasing.
This subsection was updated, the original text was not clear. Thanks to Jon R. for pointing that out.
You want to play with Linux + Apache + MySQL + PHP. How to install all the necessary stuff easily?
There is a tool called tasksel that can install multiple related packages as a co-ordinated “task”. Launch
tasksel as root and choose the task you need. There is an option called LAMP server. The packages
mysql-admin are not part of this collection, you need to install them separately.
sudo apt-get install tasksel sudo tasksel sudo apt-get install phpmyadmin
Enabling user directories
My home directory is located at
/home/jabba. Here I want to create a directory called
public_html and I want to play with PHP in this folder. The contents of this directory is accessible via http://localhost/~jabba. However, by default it’s not enabled.
Steps to follow:
First, create the directory
$HOME/public_html. Then enable user directories:
cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/userdir.conf userdir.conf sudo ln -s ../mods-available/userdir.load userdir.load
Update (20110107): There is a script called
a2enmod to create and manage these symlinks. Its opposite is
a2dismod, which disables Apache modules. See
man a2enmod. (credits go to Jesse)
And restart Apache2:
sudo /etc/init.d/apache2 restart
This tip is from here. Now HTML files are enabled in the user directory, but PHP files are still disabled!
Open the file
/etc/apache2/mods-enabled/php5.conf and locate these lines:
# To re-enable php in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. <IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_value engine Off </Directory> </IfModule>
As the comments suggest, you need to put those five lines in comments. Then restart the web server again:
sudo /etc/init.d/apache2 restart
This tip is from here. Now it should work. If it doesn’t work, you will have to delete the browser cache! Now it should really work :)
If you get the error message “You don’t have permission to access … on this server“, then it means there is a problem with file permissions. Directories (from
public_html inwards) must have have permission 755, files 644. Make sure that
user is your user name) are also accessible! Check out this script, it sets rights correctly in your
PHP: no error messages, just a blank page
By default, PHP is configured for production, thus error messages are disabled. This is not good for development, so you will have to modify your
php.ini file a bit (located at
/etc/php5/apache2/php.ini). Find these variables and change their values:
error_reporting = E_ALL & ~E_NOTICE | E_STRICT display_errors = On
Restart Apache and you are done. This tip is from here. It is also possible to change these values from a .php file (see the code below), but it didn’t work for me on PHP5.
This line had no effect in my case:
Update: as pointed out here in a comment, this line doesn’t catch any parsing errors “because the entire script is parsed before any of it is executed”. So the best solution is to modify
php.ini. However, the following line should work from a script:
Fatal error: Maximum execution time of 30 seconds exceeded
By default, your PHP scripts shouldn’t run longer than 30 seconds, otherwise the scripts will be terminated and you get this error message. This time limit can be increased in
php.ini. Modify this variable:
; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI #max_execution_time = 30 # setting 3 minutes for instance: max_execution_time = 180
After this modification, don’t forget to restart Apache.
This tip is from here.
Requirements for Symfony
If you want to use Symfony, you should install these packages too (otherwise Symfony will complain):
sudo apt-get install php5-xsl sudo apt-get install php-apc
Restart Apache. Then edit
/etc/php5/apache2/php.ini and perform this modification:
# set it to "Off" value short_open_tag = Off
Symfony provides a PHP script that checks all these requirements. It can be run from the web browser and from the command line. However, the command line version uses a different
php.ini file (in my case the CLI version is located at
/etc/php5/cli/php.ini). So run
check.php in the command-line and in the browser too.
Requirements for Yii
For Yii you might need to install these packages to pass all the tests:
sudo apt-get install php5-sqlite sudo apt-get install php5-memcache sudo apt-get install php5-pgsql
Under Ubuntu you want to use another OS (like Windows) in a virtualized environment.
As a free solution you can use VirtualBox. Be aware that it has two versions! A proprietary (also free) and an open-source edition (OSE). Some features are missing from the OSE, so I suggest using the other one.
- visit the download page and fetch the install file that matches your host system
- when the installation is done, launch the application with the command
VirtualBox(pay attention to the capital ‘V’)
There is another great (though proprietary) product called VMware Workstation. It also runs on Linux.
When I wanted to increase the number of processors available to a guest system, I got this error message: VERR_VMX_MSR_LOCKED_OR_DISABLED. It means that virtualization is disabled in the BIOS. Steps to follow (under Dell):
- Restart the machine and enter the BIOS by pressing F2.
- Go to Performance -> Virtualization, and set it On.
- Go to Security -> Execute Disable, and set it On.
Under Ubuntu we have
apt-get. Moreover, after a fresh installation we already have lots of pre-installed programs. But after installing a Windows box, what do we have? An unusable Internet Explorer…
Thank God, there is an excellent service called Ninite to help us. It contains lots of useful and free software grouped in categories. The programs are always the latest versions. Just choose what you need and download the installer which is about 200K. Launch it and it will download and install all the selected programs in just a few minutes. It doesn’t ask any questions, it will install everything with the default options. It uses threads, so while installing a software it is downloading the next one. Installing 10 programs takes no more than 10 minutes. Imagine how much time it would require if you should install all these programs manually… Ninite saves lots of time.
If you just finished installing your Windows, start IE and visit http://ninite.com immediately! Make sure that Firefox is in the list :)