Announcement

Collapse
No announcement yet.

HTML offline

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HTML offline

    Have just started to use html/php and would like to test scripts offline.
    My browser is Rekonq.
    How should I run scrip locally.
    I have an html file("test") containing:-
    Code:
    <!DOCTYPE html>
    <html>
    <body>
    
    <?php
    echo "My first PHP script!";
    ?>
    
    </body>
    </html>
    Inserting "file:///home/bill/test" as the url invokes kate editor with test loaded. Same thing if I double click on 'test'

    Where am I going wrong?

    #2
    In the Rekong browser, click on file open icon (you may need to reconfigure Rekong to show this icon. Select the file /home/bill/test.php
    This file should be named "test.php" to pass it through your local php processor.

    Do you have php (php5) loaded on your system?
    Kubuntu 24.11 64bit under Kernel 6.11.7, Hp Pavilion, 6MB ram. Stay away from all things Google...

    Comment


      #3
      I see you found the W3School PHP tutorial page! Good place to start.
      The repository has php5, which you should install, plus a host of auxiliary tools and utilities for php, depending on what you plan to use php for.
      Here is a list of repository packages that depend on php5:
      |mythweb
      zoneminder
      zabbix-frontend-php
      yubikey-val
      yubikey-ksm
      wordpress
      |websvn
      webissues-server
      ukolovnik
      typo3-src-4.5
      typo3-dummy
      tt-rss
      srg
      |squirrelmail
      spotweb
      spip
      |smarty3
      simplesamlphp
      shaarli
      serverstats
      semanticscuttle
      scuttle
      sbnc-php-dev
      rtgui
      roundcube-core
      postfixadmin
      postfix-cluebringer-webui
      pnp4nagios-web
      pluxml
      phpwebcounter
      phpunit-story
      phpsysinfo
      phpreports
      phpqrcode
      phpmyadmin
      phpbb3
      |php5-librdf
      php-zeroc-ice
      php-xml-rss
      php-xml-rpc
      php-xml-htmlsax3
      |php-xajax
      |php-wikidiff2
      php-token-stream
      php-text-wiki
      php-text-template
      php-text-password
      php-symfony-yaml
      |php-symfony-routing
      php-structures-datagrid-renderer-pager
      php-structures-datagrid-renderer-htmltable
      php-structures-datagrid-datasource-array
      php-structures-datagrid
      php-sepa-direct-debit
      |php-seclib
      |php-sabre-vobject
      |php-sabre-http
      |php-sabre-event
      |php-sabre-dav
      |php-radius-legacy
      |php-phpdocx
      |php-patchwork-utf8
      php-openid
      |php-opencloud
      php-net-sieve
      |php-net-publicsuffix
      php-net-portscan
      php-net-nntp
      php-net-ldap2
      php-net-checkip
      php-mail-mimedecode
      php-mail-mime
      php-mail-mbox
      php-log
      |php-irods-prods
      php-htmlpurifier
      php-html-table
      php-html-common
      php-horde-xml-wbxml
      php-horde-xml-element
      php-horde-view
      php-horde-util
      php-horde-url
      php-horde-tree
      php-horde-translation
      php-horde-token
      php-horde-timeobjects
      php-horde-thrift
      php-horde-text-flowed
      php-horde-text-filter-csstidy
      php-horde-text-diff
      php-horde-template
      php-horde-syncml
      php-horde-support
      php-horde-stream-wrapper
      php-horde-stream-filter
      php-horde-share
      php-horde-sessionhandler
      php-horde-service-weather
      php-horde-service-urlshortener
      php-horde-service-twitter
      php-horde-serialize
      php-horde-secret
      php-horde-scribe
      php-horde-scheduler
      php-horde-routes
      php-horde-role
      php-horde-rdo
      php-horde-queue
      php-horde-pdf
      php-horde-passwd
      php-horde-oauth
      php-horde-notification
      php-horde-nls
      php-horde-mime-viewer
      php-horde-memcache
      php-horde-lock
      php-horde-kolab-storage
      php-horde-kolab-session
      php-horde-kolab-server
      php-horde-itip
      php-horde-injector
      php-horde-imsp
      php-horde-image
      php-horde-icalendar
      php-horde-http
      php-horde-hashtable
      php-horde-group
      php-horde-gollem
      php-horde-feed
      php-horde-exception
      php-horde-elasticsearch
      php-horde-editor
      php-horde-date-parser
      php-horde-data
      php-horde-crypt-blowfish
      php-horde-controller
      php-horde-constraint
      php-horde-compress-fast
      php-horde-cli
      php-horde-browser
      php-horde-autoloader
      php-horde-argv
      |php-google-api-php-client
      |php-gettext
      |php-getid3
      |php-geshi
      |php-fpdf
      |php-font-lib
      php-file-iterator
      php-elisp
      |php-dompdf
      php-crypt-blowfish
      php-cas
      php-auth-sasl
      phamm
      owncloud
      ocsinventory-reports
      |netmrg
      nagvis
      mlmmj-php-web-admin
      mlmmj-php-web
      mediawiki
      |libzend-framework-zendx-php
      |libzend-framework-php
      |libphp-swiftmailer
      |libphp-snoopy
      |libphp-simplepie
      |libphp-phpmailer
      |libphp-pclzip
      |libphp-magpierss
      |libphp-jpgraph
      |libphp-jabber
      |libphp-cloudfusion
      |libphp-adodb
      |libownet-php
      |liboauth-php
      libnusoap-php
      |libmarkdown-php
      libkohana3.2-core-php
      libkohana3.1-core-php
      |libkohana2-php
      |libkohana2-modules-php
      libgraphite-php
      |libfpdi-php
      |libfpdf-tpl-php
      libawl-php
      |libarc-php
      letodms
      ldap-account-manager
      knowledgeroot
      |ilohamail
      icinga-web
      |htcheck-php
      hoteldruid
      graphdefang
      gosa
      |glpi
      |ganglia-webfrontend
      frontaccounting
      |freeradius-dialupadmin
      flatnuke
      fckeditor
      drupal7
      |dotclear
      dolibarr
      dokuwiki
      d-push
      collabtive
      cakephp
      cacti
      bandwidthd-pgsql
      ampache
      adminer
      |nagios3-cgi
      libjs-jquery-jfeed
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        Thanks for the replies,
        As far as I know, php5 is running. If I type 'php5' in terminal then 'ctrl+z' I get the message '[4]+ Stopped php5'
        Have changed index.php to test.php
        Opening that file (now with Firefox) I'm asked what to open it with.
        Any more ideas?

        Comment


          #5
          You test html/css/php/javascript files directly in your web browser. You can either right-click on the file and select open with then choose the web browser you want it to open or run the web browser and select file open then select the html/php file you want to open.

          As TWPonKubuntu has said it is a good idea to give the file an appropriate file extension, such as if it is a html file then give it the extension filename.html or likewise fora php file filename.php or for Javascript filename.js etc.

          Happy coding.

          Comment


            #6
            Thanks, yes - had already rename the file to test.php
            Still get this when I try to open the file in Firefox
            Click image for larger version

Name:	snapshot4.png
Views:	1
Size:	26.7 KB
ID:	640738

            Comment


              #7
              Originally posted by bill-lancaster View Post
              Thanks, yes - had already rename the file to test.php
              Still get this when I try to open the file in Firefox
              [ATTACH=CONFIG]4866[/ATTACH]
              Where it says open with, simply change the option to firefox

              Comment


                #8
                You can't run php-files inside a browser. Simply impossible. Same goes for php includes in a html-file (<?php etc.). That's why the browser offers to download it.
                php is a serverside language, what means you have to run it on a server, not inside firefox/konqueror/... The server has to process the php. The browser only gets a html-file with no php in it. The server inserts/translates/etc. the php into html.

                If you want to test php files, you have to do that on a server. If you have a site hosted somewerhe, there's a good chance the hoster has implemented php so you can test it there, after uploading. The file has to have the extension php, so the server knows it has to look for php. A html file with php in it also has to have the extension php, otherwise the server has no way to know it has to look for and process php.
                If you host on apache there's a way to write something in the .htaccess file to process every html-file like it is a php-file, but not every hoster gives access tot the .htaccess file. And if they do, not every hoster gives permission to treat every html-file like it is php, because that's taking extra processing time. (It's useless to look in a plain html-file for php, but in this configuration this is exactly what's happening.)

                The other way to test php is to install a server on your own computer. I always test php on a server outside, but I used to do it on my computer. For me lampp worked well: http://tutorialsea.com/kb/linux-tuto...in-a-linux-os/
                Warning: this worked well for me some years ago, but it are packages from outside the kubuntu distribution. It's very well possible there are better and safer ways to install a server just using kubuntu packages, but I've no experience with that.
                Last edited by Goeroeboeroe; Apr 26, 2014, 09:45 AM. Reason: traditional typo

                Comment


                  #9
                  Ah! Thank you. Have been testing & running .php files on my website. I thought I could speed things up by operating locally on my pc.
                  Now I know that this is not possible I'm happy to continue as before.
                  Thanks again

                  Comment


                    #10
                    Glad I could help. But you can speed it up if you install a local server. I remember it was not that hard. If you have to change a lot of php a lot of times, it's worth considering it.

                    Comment

                    Working...
                    X