Monday, December 22, 2008

Joomla on XAMPP

Joomla Installation on a USB stick

These are some quick notes before i forget what i've done.

Goto:http://www.joomla.org/
Download the English 1.5.8 Full Package and save it
Double-click the downloaded Joomla_1.5.8-Stable-Full_Package.zip file
Extract the files to your USB stick in the xampp\htdocs folder into a folder called joomla

If the folder does not exist then create it (about 24mb of space is needed). When finished you should have a file \xampp\htdocs\joomla\index.php on your USB stick

Run the portableapps Xampp control panel and start the mysql and apache servers
Open a web browser and goto http://localhost
Under Tools click on phpMyAdmin
Select Databases
In the Create a database text box type joomla
Select utf8_unicode_ci from the pulldown menu
Click Create

Select the Privileges tab
Click Open new phpMyAdmin window
Click Add a New User
Select Use Text field in the User name: drop down menu
In the User name: text box type in joomla
Select Local in the Host: drop down menu
Select Use text Field in the Password drop down menu
Type joomla in the Password: text box
Type joomla in the Re-type: text box
Scroll down to the Database-specific priviledges
Select joomla From the Add Privileges on the Following database pulldown menu
Add tickmarks to all the boxes in the database specific privileges
Click GO
Close the extra phpmyadmin window
Goto http://localhost/joomla

It takes a minute to load the setup program and then the Joomla Installation page is displayed. The pre-installation check is run. All items should be in GREEN. The default XAMPP install has PHP Display Errors set to ON. This tells PHP to send any errors to the browser so you can see them. For a production site, this option should be off since an error message could give information about your system, a potential security risk. For development purposes, however, this option is useful. You have to edit php.ini and change the line with display_errors to On: (line 292?) to be:

display_errors = Off

Make sure to shutdown and then restart the servers when making this change. It may also be possible to override this on a directory basis with a .htaccess file using the directive:

php_value display_errors on

But i will have to test this sometime later. Anyway, we continue with the install as the error is not fatal.

Click NEXT
Read the license and click Next
The Database Configuration screen is shown
Select mySQL as the database type
hostname: localhost
username: joomla
password: joomla
database name: joomla
click NEXT

The FTP configuration page is shown. Since we will be copying files directly to the USB stick this is not needed.

Click NEXT
Enter your uwo username as the Site Name (ie gnickers)
Add your email address
Enter joomla as the admin password
Enter joomla as the Confirm admin password
Click INSTALL SAMPLE DATA
click NEXT

After setup is complete, you are prompted to delete the installation folder (for security reasons); in fact, Joomla itself won’t run until it detects the installation folder is gone.

Goto your USB stick and delete the xampp\htdocs\joomla\installation folder
Return to the web browser and click on the Site icon
If successful the Joomla home page is displayed
Scroll down to the LOGIN section and login
username admin
password joomla

And the joomla home page is displayed. Now we have to figure out how to create custom sites.

Joomla Administrator

We go to http://localhost/joomla/administrator and the login page appears. We enter admin as the username and joomla as the password and the administration screen appears. There are 3 types of administrative users:

  • super admins - access to everything (the admin user we just logged in as)
  • admins - can access the backend but cannot install extensions or modify super admin accounts
  • managers - can access the backend but are limited to media, content, components and the main menu
Users are created from the control panel using Site, User Manager. Let's create a user with content priviledges as this will allow us to see how a regular user might use the system.

Select Site, User Manager
Click the New icon
Fill in the details for the user
Set the language to english
Set the user editor to TinyMCE
Set the time zone to Eastern Time
Select the Author, Editor or Publisher group - we decide to select Editor
Click the Apply icon

TinyMCE is a platform independent open source web based Javascript HTML WYSIWYG editor that can easily be integrated into content management systems.
See: http://tinymce.moxiecode.com/

The 3 groups of contributors have different priviledges.

  • An author can contribute content to locations defined by the administrator and modify their account information
  • An editor has all the priviledges of an author and is able to edit content written by an author
  • A publisher has editor priviledges and is able to publish content to the site if you have restricted publishing to publishers only
Odd - when we hit apply it kicked up back to the login screen and when we logged back in and looked for the new gnickers user it was not there. Did the session time-out because we took too long to add the user?

We add it again and when we go to save we see the problem. It cannot save the gnickers user because we gave it our email address which is the same as the administrator. We either need to add a different email or set the user not to receive any email - which might be the better option.

I problably should have made the gnicker user a member of the super admin group and created an editor with a different name with no email.

New - solved problem with installing extensions

When i went to install an extension i got the following error message:

* JFolder::create: Infinite loop detected
* Warning! Failed to move file.

The problem is caused not being able to find the tmp and log folders which are hard-coded to a drive letter. The problem is when you move your USB stick from machine to machine the drive letter changes.

  1. Select Site, Global Configurations
  2. Click SERVER
  3. I see the path to temp-folder is hard-coded to J:\xampp\htdocs\joomla\tmp
  4. Click SYSTEM
  5. I see the path to log folder is also hard-coded J:\xampp\htdocs\joomla\logs
I remove the J: from both places and click SAVE. Now when i load an extension the error message is gone. However, their is some debate on the forums as to the desirability of making other changes to configuration files.

The first extension i tried to install timed out when this error:

Fatal error: Maximum execution time of 60 seconds exceeded
in F:\xampp\htdocs\joomla\libraries\joomla\filesystem\folder.php on line 395

We open folder.php and see that the section being referenced in the one that reads the source directory:

$handle = opendir($path);
while (($file = readdir($handle)) !== false)
{
$dir = $path.DS.$file;
$isDir = is_dir($dir);
if (($file != '.') && ($file != '..')
&& (!in_array($file, $exclude))) {



The offending line looks to be the isDir function - if the directory name is not correct then the program is probably spinning it's wheels and then times out. We decide to change the line to be:

$isDir = is_dir($dir.'/' );

and save the file, exit Joomla and restart Joomla. Now we try to load the extension again.

  1. Select Extensions, Install/unistall
  2. Click Browse
  3. Select com_joomlaexploter_1.6.3.zip
  4. Click Upload File & Install
result - no joy so i went back to the file and discovered the same code segment so i changed line 457 and save the file.

Try again - same result - the spinner spins for a while and then the screen goes white. More research is needed.

We check the file structure on the USB stick. First the joomla global configuration settings:

xampp\htdocs\joomla\tmp

Folder exists and has files! In fact the .zip extension we tried to install is in this folder.
There are folders for each install appempt.
Each install attempt folder contains 2 folders, scripts and style
The .zip extenstion archive has 6 folders

xampp\htdocs\joomla\logs

Folder exists but only has a blank index.html file with an old creation date

Next we check the php configuration by going to Help, System Information, Php settings. We find:

upload_tmp_dir \xampp\tmp \xampp\tmp
open_basedir no value no value

Could this be the problem? We check and xampp\tmp - exists but it contains a bunch of files that were just created but with 0 bytes and are empty. Is there a conflict between the joomla global configuration and the php.ini settings?

We search php.ini for open_basedir and find:

; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =

Looks like it is not set which confirms the global settings. Joomla has set this to:

\xampp\htdocs\joomla\tmp

But that path is inthe format of a local path. The php.ini setting would be a relative path for the web server i would think. Maybe this local path should be changed to a relative path?

The path of the web server root is \xampp\htdocs so the tmp folder should be \xampp\htdocs\tmp but there is no such folder. Perhaps \xampp\htdocs\joomla\tmp is correct but that is exactly what we have in the global configuration. I think the php basedir is more likely, can we do something like:
open_basedir = /xampp/htdocs/joomla/tmp

The change is made and we restart. Same result - no joy.
I must say the Joomla wiki entry on this VERY common problem is vague and little help.

6 comments:

DannyB said...

Excellent.
Helped a lot - I got stuck where Joomla was unable to access the database using the new user I created for it, for some reason.

Thanks for this post.

gnickers said...

I just found out the in 8.10 there is an entry for Drupal5 in the synaptic package manager.

I selected the package and it install LAMP (minus phpmyadmin, i think) and asks a couple of questions such as setting up a mysql root password etc.

It does not seem to create a menu item or link anywhere. There is an index.html file created in var\www which can be viewed from http://127.0.0.1 to prove LAMP is running but where is the drupal admin page located?

looks like /usr/share where apache2 is which has a folder called default-site with the index.html 'it works' page.

the user/share/drupal5 folder has the index.php page and the install.php page.

Do we have to set up a virtual directory in apache to tell it to use this? Time to RTFM i guess...

the config file is in /etc/apache
and some other stuff in /var/lib which is probably the mysql database files

Bob Sprague said...

These are excellent instructions, Gord. Thanks very much for providing them. After much trouble with Xampp and following directions found elsewhere, I successfully set up at test environment for 1.5 using your guide on my local machine.

I am planning to migrate my 1.0.11 site YourArlington.com (http://www.yourarlington.com/joomla/). I eagerly await an answer to this question: How do I now load my current content into the test to see what works and what doesn't? Thanks you.

Bob Sprague

Jotape said...

Hi... I installed Joomla 1.5.8 successfully on XAMPP in an XP SP2 box...
The only problem I need some help with (and hope you have an answer for) is that I can't change folder permissions for some joomla components. I have RSFiles installed, and it needs write permissiones for my upload folder (says NOT WRITABLE in the component's config page)... No matter what I do, I can't set the permission (Shared the folder with full access for EVERYONE, changed security settings for the folder, changed main joomla site's folder attribute unticking the READ ONLY box...)

Any idea how I can achieve this

Thanks!

From Argentina
JP

anky said...

i found this while doing 4th step of database.........."Unable to connect to the database:Could not connect to MySQL".
instead of this i have opened the server .so now should i do to connect the database.

Unknown said...

Thanks for sharing very useful post
Web Design company in Hubli | web development company in Hubli | web designers in Hubli | IT companies in Hubli | Web Design Companies in Hubli | Software Companies in Hubli