Friday, September 17, 2010

Problem with displaying joomla correctly on XAMPP in Linux

i have used Ubuntu 10.04 Lucid Lynx.
i had used the default full installation of XAMPP for Linux 1.7.3a.

i had coded PHP applications for quite awhile and everything worked great....... but when i installed Joomla - a leading Content Management System on PHP - on my localhost, i got some gibberish nonsense like this...... full of this error and that error
i searched the net for answers but found no source helpful...... that's why putting the solution to this problem up on my blog.


in this post, i don't show you how to install joomla on your localhost.... 
i show you how to solve the problem which i faced as stated above


some assumptions for this post:
  • you have installed your XAMPP in the folder
        /opt/lampp/
  • hence your localhost site root is at
        /opt/lampp/htdocs/
  • and you have copied your joomla root files inside the folder
        /opt/lampp/htdocs/joomla/
  • thus your joomla index page will be in
        /opt/lampp/htdocs/joomla/index.php

:) :) :) :)


at first i will show you some screenshots about the Joomla installation parts:
from your browser (i used google chromium), goto  http://localhost/joomla/ 
- as you setup joomla on your localhost you will see that all page layouts of your joomla setup screens come out fine - not as gibberish as the one above. on the 2nd step you will see the following screen which checks your system pre-requisites to run. and if you have an unmodified php.ini file in your localhost (i.e. if you are installing joomla on the default settings with which you XAMPP came in), you are most likely to see this screen.
you will notice that Display Errors is Recommended to be OFF - but your Config in the system is ON.
you will also notice that it says in the Recommended settings descriptions that "Joomla will still operate even if your settings do not match"
........ i wish they were saying it right.

then after completing the setup according to joomla installation guide with faith on the statement that "Joomla will still operate even if your settings do not match" you see these gibberish screens.

when you go to http://localhost/joomla/
when you go to http://localhost/joomla/administrator/

how to solve it????
you have to turn off your localhost PHP's display_error mode.
considering that you have installed your XAMPP in the directory /opt/lampp
you have to open and edit the PHP config file from /opt/lampp/etc/php.ini with sudo rights.
type this in your linux terminal:
sudo gedit /opt/lampp/etc/php.ini
then look for the active line (i.e. the uncommented line without a 'semi-colon at the start') which says 'display_errors'. most probably it's going to read:
display_errors = On
just edit that line to read
display_errors = Off
Now restart your XAMPP server and that's it. Now your joomla pages will look as neat and clean as a brilliant piece of heaven.

when you go to http://localhost/joomla/

when you go to http://localhost/joomla/administrator/





i hope this solves your problem as it did for me.
however, there is still a little problem associated with this.




when you have given display_errors = Off, it merely means that errors can still occur in your PHP, they will just not be displayed to the browser........
this is okay for joomla and most other Content Management Systems (CMS) because joomla has it's own methods of catching errors and then displaying nice pages and layouts even if errors do occur.
But if you are using your localhost to do some other kind of PHP application development as well other than joomla or other than any CMS - you will have to re-edit the php.ini file again to read
display_errors = on
if you don't turn this on for developing PHP applications other than Joomla or any CMS, your browser won't show you any error that might have generated from mistakes in your PHP code - hence you will, perhaps, not be able to debug your php codes in other applications if display_errors = off in your php.ini file.

Therefore, a brief conclusion

  • for doing work with Joomla (or any other CMS if a similar problem occurs) in your XAMPP: 
    • edit your php.ini file to read display_errors = off 
    • then restart your XAMPP
  • for doing work with any other PHP application development in your XAMPP
    • edit your php.ini file to read display_errors = on 
    • then restart your XAMPP

    4 comments:

    1. had the same problem, went to c: xamp/php and edited the display_errors to off, can you help please

      _

      ReplyDelete
    2. what file did you say you edited? give the full path of the file please. You would need to do  sudo gedit /opt/lampp/etc/php.ini and change the display_errors to off from there.

      ReplyDelete
    3. Great information! Thank you for sharing your ideas. I like your post and share it on my twitter and Facebook wall.

      ReplyDelete
    4. A great article explaining about website development very clearly. I have no idea how many people will read your post, because I already send your post to my friend list on twitter, facebook and stumble upon.

      ReplyDelete