Jump to content

Problem on testing examples


satimis

Recommended Posts

Hi folks,I'm learning PHP according to following examples.1)Example 1 on;http://www.w3schools.com/php/php_if_else.asp

<html><body><?php$d=date("D");if ($d=="Fri")  {  echo "Hello!<br />";   echo "Have a nice weekend!";  echo "See you on Monday!";  }?></body></html>

and2)Example 2 on;http://www.w3schools.com/php/php_switch.asp

<html><body><?phpswitch ($x){case 1:  echo "Number 1";  break;case 2:  echo "Number 2";  break;case 3:  echo "Number 3";  break;default:  echo "No number between 1 and 3";}?></body></html>

Save them as test1.php and test2.php respectively.However on running;$ php test1.php (or php5)

PHP Warning:  Module 'json' already loaded in Unknown on line 0<html><body></body>

$ php test2.php (or php5)

PHP Warning:  Module 'json' already loaded in Unknown on line 0<html><body>No number between 1 and 3</body></html>s

But on;/etc/php5/apache2/php.iniI can't find the line;

; extension=json.so

Please advise how to test thest files? TIAB.R.satimis

Link to comment
Share on other sites

Search through all of php.ini for "json" and see what you find. Also, you might want to run a phpinfo page and look through the list of extensions that are enabled. Put this in a page and run it:<?phpphpinfo();?>

Link to comment
Share on other sites

Search through all of php.ini for "json" and see what you find.
No "json" found on php.ini
Also, you might want to run a phpinfo page and look through the list of extensions that are enabled. Put this in a page and run it:<?phpphpinfo();?>
$ php phpinfo.php | grep json
PHP Warning:  Module 'json' already loaded in Unknown on line 0jsonjson support => enabledjson version => 1.2.1

$ php phpinfo.php | grep extension

PHP Warning:  Module 'json' already loaded in Unknown on line 0extension_dir => /usr/lib/php5/20060613 => /usr/lib/php5/20060613mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.php extension version => 0.51

$ php phpinfo.php | grep .ext

PHP Warning:  Module 'json' already loaded in Unknown on line 0default_mimetype => text/html => text/htmldocref_ext => no value => no valuemail.force_extra_parameters => no value => no valuegettextGetText Support => enabledmbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.MYSQL_MODULE_TYPE => externalphp extension version => 0.51

B.R.satimis

Link to comment
Share on other sites

No "json" found on php.ini
Really? You posted above the line about json.so, you should at least find that one. There should be a line in php.ini near the top where it tells you which config file you're using, make sure that you're using the file you think you are.It's trying to load a certain extension twice, and I'm not sure why. There might be two lines in php.ini that both load the extension, or there might be something in an Apache config file somewhere that is loading the extension, I'm not even sure if you can do that with Apache.Also, if you haven't yet, take a look at the output of phpinfo in a web browser rather then as text, look through the list of loaded extensions and look for anything that looks out of the ordinary.
Link to comment
Share on other sites

Really? You posted above the line about json.so, you should at least find that one. There should be a line in php.ini near the top where it tells you which config file you're using, make sure that you're using the file you think you are.
$ cat /etc/php5/apache2/php.ini
[PHP];;;;;;;;;;;; WARNING;;;;;;;;;;;;; This is the default settings file for new PHP installations.; By default, PHP installs itself with a configuration suitable for; development purposes, and *NOT* for production purposes.; For several security-oriented considerations that should be taken; before going online with your site, please consult php.ini-recommended; and http://php.net/manual/en/security.php.;;;;;;;;;;;;;;;;;;;; About php.ini  ;;;;;;;;;;;;;;;;;;;;; This file controls many aspects of PHP's behavior.  In order for PHP to; read it, it must be named 'php.ini'.  PHP looks for it in the current; working directory, in the path designated by the environment variable; PHPRC, and in the path that was defined in compile time (in that order).; Under Windows, the compile-time path is the Windows directory.  The; path in which the php.ini file is looked for can be overridden using; the -c argument in command line mode.;; The syntax of the file is extremely simple.  Whitespace and Lines; beginning with a semicolon are silently ignored (as you probably guessed).; Section headers (e.g. [Foo]) are also silently ignored, even though; they might mean something in the future.;; Directives are specified using the following syntax:; directive = value; Directive names are *case sensitive* - foo=bar is different from FOO=bar.;; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one; of the INI constants (On, Off, True, False, Yes, No and None) or an expression; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").;; Expressions in the INI file are limited to bitwise operators and parentheses:; |		bitwise OR; &		bitwise AND; ~		bitwise NOT; !		boolean NOT;; Boolean flags can be turned on using the values 1, On, True or Yes.; They can be turned off using the values 0, Off, False or No.;; An empty string can be denoted by simply not writing anything after the equal; sign, or by using the None keyword:;;  foo =		; sets foo to an empty string;  foo = none   ; sets foo to an empty string;  foo = "none" ; sets foo to the string 'none';; If you use constants in your value, and these constants belong to a; dynamically loaded extension (either a PHP extension or a Zend extension),; you may only use these constants *after* the line that loads the extension.;;.........

It's trying to load a certain extension twice, and I'm not sure why. There might be two lines in php.ini that both load the extension, or there might be something in an Apache config file somewhere that is loading the extension, I'm not even sure if you can do that with Apache.
I found it here;/etc/apache2/conf.d/http.conf
Alias /squirrelmail /usr/local/squirrelmail/www	<IfModule mod_php5.c>	   AddType application/x-httpd-php .php	</IfModule>	<Directory /usr/local/squirrelmail/www>	   Options Indexes	   AllowOverride none	   DirectoryIndex index.php	   Order allow,deny	   allow from all	 </Directory>

Also, if you haven't yet, take a look at the output of phpinfo in a web browser rather then as text, look through the list of loaded extensions and look for anything that looks out of the ordinary.
Can't start phpinfo.php on Firefox
associated helper application does not exist. change the association in your preferences

Edit -> Preferencescan't find helper application thereEdit -> Preferences -> Content - File Types -> Manage"Downlaod Actions" window is emptysatimis

Link to comment
Share on other sites

If you can't look at PHP pages through the browser then the server isn't set up correctly for PHP. It looks like Apache is set up to send PHP files as a download rather then execute them, but httpd.conf should be loading PHP. If you haven't yet, read through the installation instructions for PHP, they contain info about configuring Apache:http://www.php.net/manual/en/install.unix.php

Link to comment
Share on other sites

If you can't look at PHP pages through the browser then the server isn't set up correctly for PHP. It looks like Apache is set up to send PHP files as a download rather then execute them, but httpd.conf should be loading PHP. If you haven't yet, read through the installation instructions for PHP, they contain info about configuring Apache:http://www.php.net/manual/en/install.unix.php
Something confuses me.I have a test webpage on /var/www/index.phpIt includes a php script (a php parser). It works w/o problem. The webpage can be visited with domain.com displaying online news.Performed following test;Rename index.php as index.php.oldCopy test1.php as /var/www/index.phpOn browser start domain.com, only a blank page is displayed.Edit:Ubuntu 7.10 server amd64According to;Debian GNU/Linux installation noteshttp://www.php.net/manual/en/install.unix.debian.phpperformed following steps;Following packages already installed;libapache2-mod-php5php5-mysql php5-curl php5-gd$ apt-cache policy libapache2-mod-php5
libapache2-mod-php5:  Installed: 5.2.1-0ubuntu1.5  Candidate: 5.2.1-0ubuntu1.5  Version table: *** 5.2.1-0ubuntu1.5 0		500 http://us.archive.ubuntu.com feisty-updates/main Packages		500 http://security.ubuntu.com feisty-security/main Packages		100 /var/lib/dpkg/status	 5.2.1-0ubuntu1 0		500 http://us.archive.ubuntu.com feisty/main Packages

$ apt-cache policy php5-mysql

php5-mysql:  Installed: 5.2.1-0ubuntu1.5  Candidate: 5.2.1-0ubuntu1.5  Version table: *** 5.2.1-0ubuntu1.5 0		500 http://us.archive.ubuntu.com feisty-updates/main Packages		500 http://security.ubuntu.com feisty-security/main Packages		100 /var/lib/dpkg/status	 5.2.1-0ubuntu1 0		500 http://us.archive.ubuntu.com feisty/main Packages

$ apt-cache policy php5-curl

php5-curl:  Installed: 5.2.1-0ubuntu1.5  Candidate: 5.2.1-0ubuntu1.5  Version table: *** 5.2.1-0ubuntu1.5 0		500 http://us.archive.ubuntu.com feisty-updates/main Packages		500 http://security.ubuntu.com feisty-security/main Packages		100 /var/lib/dpkg/status	 5.2.1-0ubuntu1 0		500 http://us.archive.ubuntu.com feisty/main Packages

$ apt-cache policy php5-gd

php5-gd:  Installed: 5.2.1-0ubuntu1.5  Candidate: 5.2.1-0ubuntu1.5  Version table: *** 5.2.1-0ubuntu1.5 0		500 http://us.archive.ubuntu.com feisty-updates/main Packages		500 http://security.ubuntu.com feisty-security/main Packages		100 /var/lib/dpkg/status	 5.2.1-0ubuntu1 0		500 http://us.archive.ubuntu.com feisty/main Packages

$ dpkg -l 'php5-*'

Desired=Unknown/Install/Remove/Purge/Hold| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)||/ Name		   Version		Description+++-==============-==============-============================================un  php5-cgi	   <none>		 (no description available)ii  php5-cli	   5.2.1-0ubuntu1 command-line interpreter for the php5 scriptii  php5-common	5.2.1-0ubuntu1 Common files for packages built from the phpii  php5-curl	  5.2.1-0ubuntu1 CURL module for php5ii  php5-dev	   5.2.1-0ubuntu1 Files for PHP5 module developmentii  php5-gd		5.2.1-0ubuntu1 GD module for php5ii  php5-idn	   1.2-1ubuntu1   PHP api for the IDNA libraryii  php5-imagick   0.9.11+1-4.1ub ImageMagick module for php5ii  php5-imap	  5.1.2-1ubuntu1 IMAP module for php5ii  php5-json	  1.2.1-3.2ubunt JSON serialiser for PHP5un  php5-ldap	  <none>		 (no description available)ii  php5-mcrypt	5.1.2-1ubuntu1 MCrypt module for php5ii  php5-memcache  2.0.1-1ubuntu1 memcache extension module for PHP5ii  php5-mhash	 5.2.1-0ubuntu1 MHASH module for php5ii  php5-ming	  0.3.0-11ubuntu Ming module for php5ii  php5-mysql	 5.2.1-0ubuntu1 MySQL module for php5un  php5-mysqli	<none>		 (no description available)ii  php5-ps		1.3.4-3ubuntu1 ps module for PHP 5ii  php5-pspell	5.2.1-0ubuntu1 pspell module for php5ii  php5-recode	5.2.1-0ubuntu1 recode module for php5ii  php5-snmp	  5.2.1-0ubuntu1 SNMP module for php5ii  php5-sqlite	5.2.1-0ubuntu1 SQLite module for php5ii  php5-tidy	  5.2.1-0ubuntu1 tidy module for php5ii  php5-xmlrpc	5.2.1-0ubuntu1 XML-RPC module for php5ii  php5-xsl	   5.2.1-0ubuntu1 XSL module for php5

$ sudo /etc/init.d/apache2 restart

 * Forcing reload of web server (apache2)...		 [ OK ]

$ cat /etc/php5/apache2/php.ini | grep extension

; dynamically loaded extension (either a PHP extension or a Zend extension),; you may only use these constants *after* the line that loads the extension.; leading '/'. You must also specify the file extension being used including; Directory in which the loadable extensions (modules) reside.; extension_dir = "./"; If you wish to have an extension loaded automatically, use the following;   extension=modulename.extension;   extension=msql.dll;   extension=msql.so; needs to go here.  Specify the location of the extension with the; extension_dir directive above.; Sets the directory name where SOAP extension will put cache files.

Manually edit /etc/php5/apache2/php.ini

uncomment extension=msql.soand add;extension=curl.soextension=gd.so

$ cat /etc/php5/apache2/php.ini | grep extension

; dynamically loaded extension (either a PHP extension or a Zend extension),; you may only use these constants *after* the line that loads the extension.; leading '/'. You must also specify the file extension being used including; Directory in which the loadable extensions (modules) reside.; extension_dir = "./"; If you wish to have an extension loaded automatically, use the following;   extension=modulename.extension;   extension=msql.dllextension=msql.soextension=curl.soextension=gd.so; needs to go here.  Specify the location of the extension with the; extension_dir directive above.; Sets the directory name where SOAP extension will put cache files.

$ sudo /etc/init.d/apache2 restart

 * Forcing reload of web server (apache2)...			[ OK ]

Still no improvement, browsing test1.php/test2.php/phpinfo.php

associated helper application does not exist. change the association in your preferences

satimis

Link to comment
Share on other sites

First, I'm not sure of many of your commands, I don't have a lot of experience using Unix or Linux so frankly I have no clue what commands like apt-cache, dpkg, sudo, cat etc are supposed to show or what I'm supposed to be looking for. I use as many Linux servers as I do Windows servers, but I'm not a server admin, I'm a platform-independent web application programmer, so I'm not sure what those commands mean any more than I would be able to decipher the output from a Vista console user.Second, in a few examples you used "msql". The msql extension is a valid PHP extension, although I've never used it and I don't know which DBMS it applies to, but you should probably disable all non-essential PHP extensions until you get the PHP core working. You shouldn't need any database or most any other extensions enabled, especially if you're trying to get an if statement to work. PHP just shouldn't be loading any extensions, such as the JSON extension, without you telling it to. So I would go into php.ini and disable every extension that is being loaded until you get the base examples to run. Once you get those to run, start enabling each extension individually and figure out which extension causes the problem.

Link to comment
Share on other sites

Hi justsomeguy,The scripts on the examples may have problem.$ php test1.php

PHP Warning:  Module 'json' already loaded in Unknown on line 0

$ php test2.php

PHP Warning:  Module 'json' already loaded in Unknown on line 0<html><body>No number between 1 and 3</body></html>

I found following scripts on;http://devzone.zend.com/node/view/id/625A

<html><head></head><body>Agent: So who do you think you are, anyhow?<br /><?php// print outputecho 'Neo: I am Neo, but my people call me The One.';?></body></html>

B.

<html><head></head><body>Agent: So who do you think you are, anyhow?<br /><?php// define variables$name = 'Neo';$rank = 'Anomaly';$serialNumber = 1;// print outputecho "Neo: I am <b>$name</b>, the <b>$rank</b>. You can call me by my serial number, <b>$serialNumber</b>.";?></body></html>

and created 2 files as test_A.php and test_B.php respectively.$ php test_A.php

PHP Warning:  Module 'json' already loaded in Unknown on line 0<html><head></head><body>Agent: So who do you think you are, anyhow?<br />Neo: I am Neo, but my people call me The One.</body></html>

$ php test_B.php

PHP Warning:  Module 'json' already loaded in Unknown on line 0<html><head></head><body>Agent: So who do you think you are, anyhow?<br />Neo: I am <b>Neo</b>, the <b>Anomaly</b>. You can call me by my serial number, <b>1</b>.</body></html>

Second, in a few examples you used "msql". The msql extension is a valid PHP extension, although I've never used it and I don't know which DBMS it applies to, but you should probably disable all non-essential PHP extensions until you get the PHP core working. You shouldn't need any database or most any other extensions enabled, especially if you're trying to get an if statement to work. PHP just shouldn't be loading any extensions, such as the JSON extension, without you telling it to. So I would go into php.ini and disable every extension that is being loaded until you get the base examples to run. Once you get those to run, start enabling each extension individually and figure out which extension causes the problem.
I have no clue here. I tried comment out;
extension=msql.soextension=curl.soextension=gd.so

no improvement was found. Still the same complaint even tried test_A.php and test_B.php.But if renamed them as index.php on /var/www/ then browsing domain.com can display them. test_1.php and test_2.php did not work in this way.B.R.satimis

Link to comment
Share on other sites

All of those scripts are basic, just an output statement. You should be able to save a file with no PHP code at all and still get that warning, it's a startup warning with PHP (that's why the file is unknown and the line is 0). So somewhere in the config it is being told to load the JSON extension twice. The only place I can think of for that config is php.ini, if you don't see anywhere in there where it's trying to load the JSON extension then I'm not sure what to tell you. I'm not aware of anywhere else where you might load a PHP extension other then php.ini. You can do it runtime using a PHP function, but I doubt you have some code that's running for every page. Did you install and set up PHP yourself?

Link to comment
Share on other sites

Did you install and set up PHP yourself?
Yes, already one year. This virtual box running on VMWare server is for testing with Ubuntu as Host OS and CentOS as Guest OS. I have a test webpage, single page, running on Ubuntu for sometimes without problem. SquirrelMail is also running on Ubuntu as webmail. A PHP parser is running on the webpage integrating to RSS of other news sites. It also works w/o problem. News are updated automatically.I scp test1.php, test2.php, test_A.php and test_B.php files to an Archlinux box.$ php test1.php/test2.phpw/o output$ php test_A.php/test_B.phpwork w/o problem with output.I can't understand the cause.satimis
Link to comment
Share on other sites

It makes sense that they work on the other server - the problem is not with the PHP code, the problem is with the PHP configuration on the server. Again, it's trying to load the same module twice (or some other module is loading the JSON module itself). I wouldn't be able to remotely tell what the problem is, so all I can say is to work through the installation steps in the manual. Every installation I've done, the only thing I've done is followed the manual to the letter, and it's always worked for me. Every broken installation I've repaired for someone else was because they did not follow the instructions and skipped a step.

Link to comment
Share on other sites

It makes sense that they work on the other server - the problem is not with the PHP code, the problem is with the PHP configuration on the server. Again, it's trying to load the same module twice (or some other module is loading the JSON module itself). I wouldn't be able to remotely tell what the problem is, so all I can say is to work through the installation steps in the manual. Every installation I've done, the only thing I've done is followed the manual to the letter, and it's always worked for me. Every broken installation I've repaired for someone else was because they did not follow the instructions and skipped a step.
Hi justsomeguy,I found my solution.$ php phpinfo.php | grep php.ini
PHP Warning: Module 'json' already loaded in Unknown on line 0Configuration File (php.ini) Path => /etc/php5/cli/php.ini

$ cat /etc/php5/cli/php.ini | grep json

extension=json.so

Edit /etc/php5/cli/php.inicomment out the line;

;extension=json.so

$ php phpinfo.php | grep php.ini

Configuration File (php.ini) Path => /etc/php5/cli/php.ini

The warning gone.Is there an easy way testing a PHP script on a page consisting multiple scripts such a HTML, CSS, Javascript and PHP. If running;$ php page.phpIt'll only display the command of other scripts. I have to do it in a stupid way. Copy and rename page.php on /var/www/index.php. Run it on browser by evoking domain.comAnyway advice? TIAEdit:The script of Example_1 may have problem.$ php test1.php No printoutB.R.satimis

Link to comment
Share on other sites

If you're writing a web application it will be best to test it in a browser rather than in the shell. You can easily write PHP programs that don't output HTML if you want to, but if you're going to be making dynamic web pages then it will probably be easier to just keep a browser open to the page you're editing and refresh when you want to see the changes.

Link to comment
Share on other sites

If you're writing a web application it will be best to test it in a browser rather than in the shell. You can easily write PHP programs that don't output HTML if you want to, but if you're going to be making dynamic web pages then it will probably be easier to just keep a browser open to the page you're editing and refresh when you want to see the changes.
One thing I can't resolve. Even browsing the script in browser it can't be displayed disregarding whether or not renaming it as index.php and/or moving it to /var/www. It always complains with the following warning;
/path/to/phpinfo.php could not be opened, because the associated helper application does not exist, Change the association in your preference

I must run "domain.com" to visit the script on /var/www/I'm running Firefox. I'm unable discovering "helper application" on its preference. I have been googling around without result.Could you please shed me some light? ThanksB.R.satimis

Link to comment
Share on other sites

That could be one of two things. Either the server is not configured to run PHP files or it's sending out the wrong MIME type. I assume that message is coming from Firefox. First, install Firebug if you haven't yet:http://www.getfirebug.com/Once Firebug is installed, load the page in Firefox that gives you that error. After you press OK on the box, I think you should be able to see either a little green checkmark or a red X in the bottom right of the status bar. You should be able to double-click on that icon to open Firebug for the page. Click on the Net tab in the Firebug console, and you should see the entry for your page listed. Click on the entry and then click on the Response tab. Check to see what the content-type header says, it should say text/html.If it says anything other then that, then the server is telling the browser to download the page instead of executing it (and since Firefox doesn't have an application mapping for .php files, it gives the error). I'm not sure how to configure either the PHP mapping or MIME types in Apache, but I guarantee that the PHP manual will have the answers. Start on this page and read through it, then hit whatever links in the table of contents apply to your setup:http://www.php.net/manual/en/install.unix.php

Link to comment
Share on other sites

That could be one of two things. Either the server is not configured to run PHP files or it's sending out the wrong MIME type. I assume that message is coming from Firefox. First, install Firebug if you haven't yet:http://www.getfirebug.com/Once Firebug is installed, load the page in Firefox that gives you that error. After you press OK on the box, I think you should be able to see either a little green checkmark or a red X in the bottom right of the status bar. You should be able to double-click on that icon to open Firebug for the page. Click on the Net tab in the Firebug console, and you should see the entry for your page listed. Click on the entry and then click on the Response tab. Check to see what the content-type header says, it should say text/html.
I can't get "firebug" installed. Clinking the icon has no response. Is there any clue?B.R.satimis
Link to comment
Share on other sites

Are you not able to click the button on their website? Or the browser toolbar? If it's already installed you can go to Tools -> Firebug and enable and open it from there. If you can't install it from the website, make sure you're using the latest version of Firefox.

Link to comment
Share on other sites

Are you not able to click the button on their website? Or the browser toolbar? If it's already installed you can go to Tools -> Firebug and enable and open it from there. If you can't install it from the website, make sure you're using the latest version of Firefox.
I'm unable to click the button on their website to install the software. There is no response. I'm running Mozilla Firefox 2.0.0.13 which I think is the latest version. I also tried deleting .mozilla directory/folder w/o result. However their website works on SeaMonkey. Clicking the button has effect.I think it is not Firefox. If their website is running MS JavaEngine not Sun's Java then Firebox won't work on it. I encountered this funny problem before a website requested visitors running MS IE to browse their site because they were running the obsolete MS JavaEngine. Finally I have to run MS IE on Wine to visit their site. Nowadays nearly 99% websites are platform inpendant. Except some websites insist visitors running MS IE to browse their sites for reason best known to them.I shall stop testing PHP on this Virtual box which runs VMWare Server with Ubuntu as Host OS and CentOS as Guest OS. I was testing the basic PHP scripts on the LAMP server which is running on Ubuntu. Since it it a LAMP server only limited X packages/software installed because of security reason. X won't run on boot except in need.I'll build another Apache web server to continue my learning on PHP. Nowadays it is not difficult to build a web server with;http://www.apachefriends.org/en/xampp.htmlOf couse if you need to learn the complete technique on setting up an Apache web server you have to starting from software components. However on going through the hard way you'll learn a lot, not with the mouse clicking around on screen. In particular the rules on iptables, the packet filtering software, are very useful. You can setup very ridgid rules on iptable to regulate the output and input on packages. You even don't need a firewall.Anyway thanks again for your support in the past.B.R.satimis
Link to comment
Share on other sites

Hi justsomeguy,By chance I found firebug on;https://addons.mozilla.org/en-US/firefox/addon/1843as Firefox addon.I got it installed. It is now running.Start;http://www.getfirebug.com/Tools --> Firebug --> Open Firebug in New WindowUnder Console, there is a red line

[Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///usr/lib/firefox/components/nsSessionStore.js :: sss_saveState :: line 1753" data: no][Break on this error] oState.session = { state: ((this._loadState == STATE_RUNNING) ? STATE_RUNNIN...

Under HTML/CSS/Script/DOM/NetNo warning found.Any other place I have to check? ThanksB.R.satimis

Link to comment
Share on other sites

The console is where all of the error messages get printed. You can write something yourself to the console if you use console.log. If you want to see the contents of a certain variable or object you can use console.log to print it to the Firebug console.Do you get that error on every page (e.g. google.com) or just the pages you're working on?

Link to comment
Share on other sites

The console is where all of the error messages get printed. You can write something yourself to the console if you use console.log.
Yes, the right window can be edited. I don't have console.log running.$ sudo find / -name console.logPassword:No printout.On Debian console-log is a package/software;Package: console-log (1.0-13)http://packages.debian.org/stable/admin/console-logUbuntu is based on Debien. I found this pacakage on repository$ apt-cache policy console-log
console-log:  Installed: (none)  Candidate: 1.0-13  Version table:	 1.0-13 0		500 http://us.archive.ubuntu.com feisty/universe Packages

I'll install it later.On googling I found following interesting threads;Console Logshttp://publib.boulder.ibm.com/tividd/td/BS...TML/bsmd124.htmdbug - a console.log (ifrebut) wrapperhttp://clientside.cnet.com/?p=144Console APIhttp://www.getfirebug.com/console.htmlFrequently Asked Questionshttp://www.getfirebug.com/faq.htmlSimulating a Firebug, Safari or Opera debugging console in Microsoft Internet Explorer with Faux Consolehttp://icant.co.uk/sandbox/fauxconsole/

If you want to see the contents of a certain variable or object you can use console.log to print it to the Firebug console.
Could you please explain in more detail how to do it. TIA
Do you get that error on every page (e.g. google.com) or just the pages you're working on?
No, only on getfirebug pages with "Show JavaScript Errors" and "Show JavaScript Warnings" options up.I just tested that page again the warning gone.Now I enable all options on firebug and found following warnings;On this page (w3schools forum)
Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedindex.php (line 673)Unknown property 'filter'. Declaration dropped.[Break on this error] undefinedindex.php (line 1530)Unknown property 'filter'. Declaration dropped.[Break on this error] undefinedindex.php (line 1687)Unknown property 'filter'. Declaration dropped.[Break on this error] undefinedindex.php (line 1727)Error in parsing value for property 'clear'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 95)Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 97)Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 114)Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 126)Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 183)Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedcss_rte.css (line 276)Unknown property 'word-wrap'. Declaration dropped.

google.com

Error in parsing value for property 'cursor'. Declaration dropped.[Break on this error] undefinedwww.google.com (line 1)Error in parsing value for property 'height'. Declaration dropped.[Break on this error] undefinedwww.google.com (line 1)Error in parsing value for property 'width'. Declaration dropped.

The warnings seem relating to parser?B.R.satimis

Link to comment
Share on other sites

The warnings are normal, these pages actually do have those errors on them. Those are mostly CSS errors, you can click through the tabs in Firebug to see the different types. The first few on this site are Javascript errors that this forum has that will never, ever be fixed.

Could you please explain in more detail how to do it. TIA
<script type="text/javascript">var msg = 'this gets written to the firebug console';console.log(msg);console.log(document.getElementsByTagName('body'));</script>
Link to comment
Share on other sites

Hi justsomeguy,Thanks for your advice and script.Have console-log installed$ sudo apt-get install console-log

............Looking for keymap to install:NONESetting up daemon (0.6.3-1) ...Setting up kbd (1.12-17) ... * Setting console screen modes and fontsSetting up console-log (1.0-13) ...Adding system userWarning: The home dir you specified does not exist.Allowing use of questionable username.Adding system user `Debian-console-log' (UID 115) ...Adding new group `Debian-console-log' (GID 120) ...Adding new user `Debian-console-log' (UID 115) with group `Debian-console-log' ...Not creating home directory `/var/run/console-log'.Adding user `Debian-console-log' to group `adm' ...Done. * Starting console-log	  * W: /var/log/mail.log not readable by Debian-console-log...			[fail] 																		 [ OK ]Setting up console-common (0.7.68) ...Looking for keymap to install:NONE

* Starting console-log	  * W: /var/log/mail.log not readable by Debian-console-log...			[fail] 																		 [ OK ]

$ ls -l /var/log/mail.log

-rw-r----- 1 root adm 4061408 2008-04-11 23:38 /var/log/mail.log

I'll sort out this problem later.$ sudo find / -name console.logNo printout. Can't find this file?$ whereis console-log

console-log: /etc/console-log.conf /usr/share/console-log

$ cat /etc/console-log.conf

tty 9# uncomment next line if you want to chvt to the syslog on startup#chvt yesfile /var/log/sysloggroup admtty 8file /var/log/exim4/mainlog /var/log/exim/mainlog /var/log/mail.loggroup adm

<script type="text/javascript">var msg = 'this gets written to the firebug console';console.log(msg);console.log(document.getElementsByTagName('body'));</script>
Where shall I keep this file so that it will be evoked automatically? TIAB.R.satimis
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...