Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Where to Put PHP Code


  • Please log in to reply
3 replies to this topic

#1 clookid

clookid

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 123 posts

Posted 10 January 2007 - 03:04 PM

Where to put PHP code

When the PHP program runs through your script, it looks for either <?php or <? then runs everything from there until the next ?>

You can configure PHP to run code between <% and %> tags too (ASP) though on IIS this probably isn't the wisest of ideas.

You need to tell your web server to run PHP files through the PHP program, too. This depends on which web server you have, though the PHP package has good instructions for most of the popular types. You should put your PHP code in files with the extension .php and configure your webserver to run .php files through the PHP program, though you can also force PHP to handle all .html files. The advantage to setting up .php as an extension is that files with no PHP code won't go through the PHP program, so you'll get better server performance.

This tutorial was written by another one of my friends, if you would like to use this tutorial please send me a PM
  • 0

#2 xtraze

xtraze

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 872 posts

Posted 11 January 2007 - 06:44 PM

But, this limits us to use .php for php codes doesn't it and we cannot add php codes into HTML if this is done. But if it does improve server performance, I will try if I get a VPS or Dedicated.
  • 0

#3 mohafib

mohafib

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 19 January 2011 - 06:28 AM

Hi,

clookid plz am newbie in PHP, plz can u help me? in my work place they ask me the create a Databank for our Staff, to verifed them for payment of salary, but i don't know how to create it. if u can help me am very happy here is my email mohafib@yahoo.com.

thank u very much and god bless u and ur family
  • 0

#4 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 02 June 2011 - 03:43 PM

xtraze:
Simply solution:
Rename all your .html files to .php, Oh wait I guess that does kinda compromise run speed :D
TO be honest on a PHP server every page should be using PHP for headers and footers (even without MySQL you can use the include or require functions).
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download