|
| |||||||
|
|
||||||
| |||||||
|
|
|
AppServ will install in your Pc Apache Php MySQL to run an internal Pc Server for exercising your php-programming. We recommend to beginners to install the "easy" version of AppServ and insert in the install MySQL window the future access data that will be used when publishing on a real website. Imagine your hard disk divided in 2 parts : A - B Part A is the localhost and is structured as a Server and will be installed by AppServ [...and will serve Part B of your hard disk ] localhost includes : - Apache Server having the module PHP that has a path to comunicate with MySQL Server - MySQL Server The remaining part B of your hard disk, will be the "Client" and will include all programs an applications and of course your Browsers. Just as by surfing the web for any http-URL with your browser, you can query your localhost by typing in your preferred Browser : ...so if you place a test file in that folder e.g. : test.php simply encode that to the URL string like this : http://localhost/test.php and part B (your machine), by using your browser asks a file to Apache in part A ...The php-parser of Apache checks also if there is any relation or query in the file to the MySQL Server and if so, these are parsed by PHP that translates the results in html and javascript to the client-browser in a final OUTPUT. All what happens in localhost is just the same as on the real Web Server provided of Php-Extensions So you can exercise and test your code in localhost before publishing on your Web Server. |
|
|
Webdesigners normally start unaware of interactivity server-supports to design their projects.
Then one day they find out that with Php they can get support for webmailing, or they need a database to store access data for a Members'Area into their templates, or supporting a Chat or a Php-based Forum. A bad new is that they will have to rework a lot of links and change a lot of file extensions into their folders.
A php file returns all html code that contains under the control of the php parser, whilst all php code that might be included into an html file, is not returned ...UNLESS the server administrator has set a Cross Scripting System for their users. The cross scripting settings consists in processing html-files just as they were php and this means that before the Web Server returns an answer to the Client the php parser must be activated for each html request too ... this means much more server internal activity also for pages that really do not need to be processed, it involves more efforts and power to get thngs flowing. [ so this is normally not set in the majority of the web servers ] As a result of this if a php script is set into an html file the code will not be properly parsed by the server that will read that code as "broken-text" partially hidden by the opening php script tag ...so the following code : That php code above [in red] should have outputted in an html cross script server-settings the following result : PHP The text in above line [ in black and bold ] would be the result of a file in php extension containing the same code outlayed in red a few lines above. ...in conclusion a file in php extension can contain html code and javascript before and after the php code, but a file in html extension cannot normally host php code in its source. Besides that it is to be reminded that if in a php file some functions and scripts in php are set after html and javascript code, they will not be properly parsed and executed by the Web Server, a way around to this is to use sometime the javascript support in such cases instead. |
Nb : in php.ini file output_buffering must be commented or set to 0 in order to get the error above [ output_buffering = 4096 ]
Output buffering allows you to send header lines (including cookies) even after you send body content, at the price of slowing PHP's output layer a bit. You can enable output buffering during runtime by calling the output buffering functions. You can also enable output buffering for all files by setting this directive to On. If you wish to limit the size of the buffer to a certain size - you can use a maximum number of bytes instead of 'On', as a value for this directive. ...In recent versions of php as in 4.3.11 AppServ - Stable this parameter allows the php code to retrieve the headers that were already sent, so no error will be returned in this case. | ||