Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

  1. #1

    Default KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Hello,
    I know this might be a 'little thing' to some, but This is Bugging me Huge:

    *'New' observations since I originally posted at KDE, where as usual, No one has even viewed the post.
    * KDE > Konqueror AS Root > Navigate to ~/MyDocs/Inet Publishing/ (directory with websites in it), Konqueror displays the *.php files with the default 'PHP' mimetype icon ( screencap ) and open them with Kate and Not with kwrite as it would if the document was an HTML file.
    * Also, Dolphine (wich I dislike), as User (not root) shows the correct mimetype icon and associated app (kate) for php

    I'm hopping that my luck with openSuSE holds true with this problem.

    Here is the long winded version of my 'problem'
    For no reason I can find, Konqueror is displaying my *.php files using mimetype HTML.
    Until today, I had it set up in File Associations, if I click on a PHP file, Kate would open and the 'icon' would be my PHP mimetype and HTML files would not only have an HTML mimetype icon, but would open in KWrite.

    Image of dir using HTML for PHP
    Image of dir using proper PHP mimetype icon
    *note: i created the icons in gimp, but am certain they have nothing to do with this issue. again, this is an 'new issue' for me and i've been using these icons for a very long time.

    Al of the sudden, but after Kate locked up and would not 'die' after many attempts to 'Kill' it. (locked while I was in Settings > Configure Kate). I was forced to power down the computer and cold start.

    To make a weird thing weirder is that it is Not All Directories. Some sub-directories of the same project display some PHP files using the mimetype icon = php and open in Kate and Some are displaying php files with mimetype icon HTML and opening in KWrite.
    All the files with .php extensions Are php, at a minimum contain at least one php include statement. Both the files display HTML or PHP icons.

    I've noticed this little issue, when I started creating .mediawiki documents. it seemed Konqueror would interpret them as '.C' code files or 'normal' and Not mediawiki mimetypes. To 'fool' konqueror or really 'the system' I would put at the top of the document, '< ! DocType mediawiki > (NO spaces, obviously)... So, what I'm saying is that it seems 'the system' or konqueror is actually Reading the contents of the file instead of the file Extension...
    What do you think?

    Any Ideas Please?
    Reed.

    -- edit --
    one more thing. on my web servers, all the mimetypes seem to be right, but i also have x-app set in file associations that might be different from the 'text' setting.

  2. #2

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    * Also, Dolphine (wich I dislike), as User (not root) shows the correct mimetype icon and associated app (kate) for php
    (screen cap )

    So,,, this seems to be confined to Konqueror and Only for the last few days... ????

    Thanks,
    Reed.

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,399

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    There is a general problem of recognizing what the contents of a file represent. Only "intelligent guesses" can be made. IMHO the command
    Code:
    file
    is the one doing it the best.

    Dolphin (not: Dolphine) is not doing much file content testing I am afraid. It uses (at least in many cases) the suffix of the file name instead of looking inside for magic numbers. Example:
    Code:
    henk@boven:~/test/bestanden> ls -l verf*
    -rw-r--r-- 1 henk wij 157943 10 mei  2013 verf.gif
    -rw-r--r-- 1 henk wij 157943 10 mei  2013 verf.jpeg
    henk@boven:~/test/bestanden> diff verf*
    henk@boven:~/test/bestanden> file verf*
    verf.gif:  JPEG image data, JFIF standard 1.01
    verf.jpeg: JPEG image data, JFIF standard 1.01
    henk@boven:~/test/bestanden>
    In other words, two files are exactly the same and the file command detects that it is a JPEG image.

    Dolphin and Konqureor both think that the one is a GIF and the other is a JPEG. Not very clever.

    My conclusion: it is quite possible that both Dolphin and Konquerror have a different algorithm for deciding what the contents of a file represents and that both are not very good at it and that both act different from each other.
    Maybe both should use the file command internaly instead of their own mechanism

    BTW, for the case of PHP vs. HTML, the only way to be sure about the one or the other would of course be to read the whole file to see if there is any <?php string inside it. That wouild make it a very resource consuming process.
    Henk van Velden

  4. #4

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Quote Originally Posted by hcvv View Post
    ....
    Maybe both should use the file command internaly instead of their own mechanism

    BTW, for the case of PHP vs. HTML, the only way to be sure about the one or the other would of course be to read the whole file to see if there is any <?php string inside it. That wouild make it a very resource consuming process.
    Thank You very much for your input.
    I would like the file manager to look at prefix Only.
    konqueror if definitely looking in the files plus something else, because a file Name.php and it's backup made during editing, Name.php~ have different 'mimetype icons' yet the same content. Also, there is a 'File Association' specifically for 'bak' files called 'Trash' and this is being ignored now too.

    BTW, it is better now, but I don't know why.
    I removed text association for php and added x-php, turned of (disabled) konqueror Extension 'Directory Filter' and disabled Konqueror > Settings > File Management > General > Preview > HTML...
    Don't know what changed, but.... again, some what better now.

    Again, Thank you.
    Reed

    p.s. I have a grep search going on .kde4 and .local going. looking for 'mimetype' entries.

  5. #5

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    FYI: found that there are .xml files that define mimetype extensions, the icon to use, but not the application in:
    ~/.local/share/mime/[text]/php.xml (for example). One for each file type i've added, which contains the following.
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="text/x-php">
      <!--Created automatically by update-mime-database. DO NOT EDIT!-->
      <comment>PHP Server Side 'Personal Home Page' files</comment>
      <icon name="/usr/share/icons/php64.png"/>
      <glob-deleteall/>
      <glob pattern="*.PHP*"/>
      <glob pattern="*.php"/>
      <glob pattern="*.php.*"/>
      <glob pattern="*.php3*"/>
      <glob pattern="*.php4*"/>
      <glob pattern="*.php5*"/>
      <glob pattern="*.phps*"/>
      <glob pattern="*.php~"/>
    </mime-type>
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="text/mediawiki">
      <!--Created automatically by update-mime-database. DO NOT EDIT!-->
      <comment>MediaWiki - Wiki Markup pseudo HTML</comment>
      <icon name="/usr/share/icons/mimetype-mediawiki.png"/>
      <glob-deleteall/>
      <glob pattern="*.MediaWiki"/>
      <glob pattern="*.MediaWiki.*"/>
      <glob pattern="*.mediawiki"/>
      <glob pattern="*.mediawiki.*"/>
    </mime-type>
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="text/kateproject">
      <!--Created automatically by update-mime-database. DO NOT EDIT!-->
      <comment>Kate Editor Project File</comment>
      <icon name="/usr/share/icons/text-x-katefilelist.png"/>
      <glob-deleteall/>
      <glob pattern="*.kateproject"/>
      <glob pattern="*.kateproject.*"/>
      <glob pattern=".kateproject"/>
      <glob pattern=".kateproject~"/>
    </mime-type>
    many others, but again, only for extensions i've added.

    and of course the files that kept getting changed that mozilla Firefox defers to:
    ~/.local/share/applications/mime.cache, mimeinfo.cache and mimeapps.list, but these only launch the associated application. My issue seems to be with the interpretation of the file in determining the mimetype... Hmmmm
    *note. the mimetype cache file points to /var/cache/gio-2.0/gnome-defaults.list file. this one busted my chops a long time, messing with FF and default application for pdf.. inkscape kept being added as the viewer.

    Still looking...
    Reed

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,399

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Hm, I am not sure you are on the correct way in adding MIME types of your own invention.

    MIME types are used on the internet to indicate the type of data that a file contains. PHP files are not normaly send over the internet. The resulting HTML is, and then of course have the MIME type text/html.

    The list of MIME types is registered by IANA and adding things to your local list is of course entirely local to your environment.

    And I do not think the icons used by file browsers are to be termed as MIME type icons. As said MIME types are on the internet. On a computer there of course files with contents that correspond with MIME types when send over the internet, but are many more other file content types that do not have any corresponding MIME type.
    Henk van Velden

  7. #7

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Quote Originally Posted by hcvv View Post
    Hm, I am not sure you are on the correct way in adding MIME types of your own invention.

    MIME types are used on the internet to indicate the type of data that a file contains. PHP files are not normaly send over the internet. The resulting HTML is, and then of course have the MIME type text/html.....
    Yes, you're right, i know.

    I am talking about File Type / Application Association within KDE (openSuSE).
    I just call it 'mimetype' as that is what seems to get my point across when talking about association.

    I'm not sure what else to call the overall idea...

    I am actually talking about the association between the File.Ext, the 'file manager', the icon associated with the file type and the Application that my system / file manager uses to open a given file type (file.ext)... : (

    Thank You again,
    Reed.

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,399

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Well, it is called Filetype Association in KDE (maybe other desktops call it diferent). In fact it is a Filename Suffix Association because, as we have seen, it only looks to the suffix of a file name.

    Apparently it tries to emulate the MS-DOS file name extentions
    Henk van Velden

  9. #9

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype. Why?

    Quote Originally Posted by hcvv View Post
    ... In fact it is a Filename Suffix Association because, as we have seen, it only looks to the suffix of a file name.
    ...
    And there lies the rub... Konqueror is Not looking at the 'File Association Suffix' only. If it was, I would not be having a problem. It seems Konqueror is 'Reading' the document, using something called 'magicdata', i guess.

    I wish it would ONLY read the extension. I hate when the 'tools' think they are smarter than they really are.

    Thanks,
    Reed

  10. #10

    Default Re: KDE Filemanager (konqueror) displaying php files as html doctype.Why?

    On 03/04/2014 07:16 PM, TyReed pecked at the keyboard and wrote:
    > hcvv;2628503 Wrote:
    >> ... In fact it is a Filename Suffix Association because, as we have
    >> seen, it only looks to the suffix of a file name.
    >> ...

    > And there lies the rub... Konqueror is Not looking at the 'File
    > Association Suffix' only. If it was, I would not be having a problem. It
    > seems Konqueror is 'Reading' the document, using something called
    > 'magicdata', i guess.
    >
    > I wish it would ONLY read the extension. I hate when the 'tools' think
    > they are smarter than they really are.
    >
    > Thanks,
    > Reed
    >
    >

    You need to stop thinking in MS Windows ways and become assimilated in
    the linux way of doing things.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •