Core PHP Interview Questions and Answers
yes we can use it.
Default type is MyISAM
Generates 3 files
1.frm
2.Myd
3.Myi
format files
include();–> include the file, but in case of file missing
throws a warning and continues execution of code of next line.
require();–> require also includes the file but in case of
file missing throws an fatal error and stop the execution of
the code of next line.
include_once();–>if same file was included first it will
not include the file another time.
mysql_fetch_object : will return the results from database
as objects. fields will be accessible like in objects
i.e $result->name,$result->cust_name
mysql_fetch_array : will return the results from database as
array. fields will be accessible like in objects
i.e $result[name],$result[cust_name]
4 ways
1. mysql_fetch_rows
2. mysql_fetch_object
3. mysql_fetch_assoc
4. mysql_fetch_array
get() method sends data in the form of url but post() method
will send as a data stream.
data transfered thru get() method is not secured whereas
post() method is safe and secured.
data sent thru get() method will be truncated but for post()
method there is no limitation on the amount of data being sent.
Who know who is the father of php is any one knows that
please comment on this??????
if u ask who is the developer of the php then i tell RASMOUS
LEDORF…….
The documentation below also applies to require(). The two
constructs are identical in every way except how they handle
failure. They both produce a Warning, but require() results
in a Fatal Error. In other words, use require() if you want
a missing file to halt processing of the page. include()
does not behave this way, the script will continue
regardless. Be sure to have an appropriate include_path
setting as well. Be warned that parse error in included file
doesn’t cause processing halting in PHP versions prior to
PHP 4.3.5. Since this version, it does.
Files for including are first looked for in each
include_path entry relative to the current working
directory, and then in the directory of current script. E.g.
if your include_path is libraries, current working directory
is /www/, you included include/a.php and there is include
“b.php” in that file, b.php is first looked in
/www/libraries/ and then in /www/include/. If filename
begins with ./ or ../, it is looked for only in the current
working directory or parent of the current working
directory, respectively.
When a file is included, the code it contains inherits the
variable scope of the line on which the include occurs. Any
variables available at that line in the calling file will be
available within the called file, from that point forward.
However, all functions and classes defined in the included
file have the global scope.
Example #1 Basic include() example
vars.php
test.php
********and in include_once is as below**********
he include_once() statement includes and evaluates the
specified file during the execution of the script. This is a
behavior similar to the include() statement, with the only
difference being that if the code from a file has already
been included, it will not be included again. As the name
suggests, it will be included just once.
include_once() may be used in cases where the same file
might be included and evaluated more than once during a
particular execution of a script, so in this case it may
help avoid problems such as function redefinitions, variable
value reassignments, etc.
for example::>
include_once() with a case insensitive OS in PHP 4
Document Root is the webservers default directory from
which webserver serves the web documents according to
clients request. When we type website address in address
bar of browser. It displays the default document which we
have define with webserver configuration and it comes from
directory which we have defined as Document Root in web
server configuration.
According to Wrox Press – Professional programming PHP the
First meaning of PHP is “Personal Home Page”.Later it was
PHP Hypertext Processor
A PHP session variable is used to store information about,
or change settings for a user session. Session variables
hold information about one single user, and are available
to all pages in one application
i think we can give this ip address as first argument of
mail function, coz the first argument of mail function need
a address to send mail, so it can be used there.
am not dead sure about my answer, if anyone find it true or
false then please let me know at my email
ISAPI mode. If you are going to install PHP in an ISAPI
mode, be aware that you must copy some DLL files to get PHP
to function correctly. PHP uses several DLLs, such as the
PHP4TS.dll file and DLL files in both the DLL and
extensions folders. I will cover DLLs in the extensions
folder later in this article. For now, you must work with
the PHP4TS.dll file and DLL folder files. Use the following
steps.
You must make the files available to the ISAPI module. I
recommend that you copy the files into the
C:WINNTSYSTEM32 folder. While you may copy the files into
the C:PHPSAPI folder, putting the files in the
C:WINNTSYSTEM32 folder is preferable.
Open the Microsoft Management Console (MMC) for IIS web
server for your selected web server and website. (The same
options apply here as in the CGI installation listed
above).
Open the Properties dialog box, select the ISAPI tab, and
select Add.
In Filter Name, add the name of the ISAPI filter. (For this
article, I entered: “PHPâ€.)
In the Executable field, either use Browse or type the path
to C:PHPSAPIPHPISAPI.dll
You should see the following:
4-Click the OK button and select the Home Directory tab and
the Configuration button. The procedure here is identical
to the CGI installation listed above.
In the Executable, use Browse or type the path to your PHP
folder and the PHP4ISAPI.dll file (for this article, it is
C:PHPSAPIPHP4ISAPI.dll).
In the Extension type, enter the file extension that the
server should use to refer to PHP scripts (this is most
commonly the .php extension).
You should see the following:
Click OK, Apply, and OK to complete the settings.
Stop and restart the web server. To do this, use the
Services utility in Control Panel within Administrative
Tools (Start > Programs > Administrative Tools > Services
or Start > Settings > Control Panel > Administrative Tools
> Services). Then right click the IIS Admin Service and
select Restart. You may also use the Command console to
start/stop the web server, as follows:
To stop the web sever enter: Net stop iisadmin
To restart the web server enter: Net start w3svc
When the web service has restarted, open the ISAPI tab as
described in steps 2 and 3 above.
Ensure that the ISAPI has loaded correctly. The ISAPI
should be green, not red; red indicates that the ISAPI has
failed to load. If the ISAPI has not loaded correctly,
ensure that your paths to the ISAPI files are correct and
that you copied the DLL files into the correct locations.
If the ISAPI loads correctly, you are ready to test your
PHP installation.
Yes,easyphp include webserver,php and mysql
Use FTP to upload php files (script)
Create database in Mysql server.
A Content Management System ( CMS ) is used to add, edit,
and delete content on a website. For a small website, such
as this, adding and deleting a page manually is fairly
simple. But for a large website with lots of pages like a
news website adding a page manually without a content
management system can be a headache.
A CMS is meant to ease the process of adding and modifying
new content to a webpage. The pages content are stored in
database, not in the file server.
This tutorial will present an example of a simple content
management system. You will be able to add, edit and delete
articles using HTML forms.
For the database table we’ll call it the news table. It
consist of three columns :
* id : The article’s id
* title : The title of an article
* content : The article itself
there are three tier application
1–first tier Client “Request”
2–second tier Web server or PHP “Response from Back end or third tier”
3–third tier Mysql or BackEnd Database
PHP is a serverside scripting language.
variables and escape sequences for special characters will
not be expanded when they occur in single quoted strings.
E.G.
$var = 10;
//if we type
echo “$var”; // output : 10
echo ‘$var’; // output : $var
echo “nabc”; //output: abc
echo ‘nabc’ //output :nabc
Indexing is a technique to add or search for particular data
from database.
Regarding the types of indexing I’m a little confused coz
i dint find 32 types but a few of them are:
. primary key index:
.unique index
.bitmap index
.hash index
.function based index
.Virtual index
. Binary Search style indexing
. B-tree indexing
. Inverted list indexing
. Memory List indexing
. Table indexing
and/or
>clustured
>unclustured
php is a hybrid language which has got both procedure and
oop concepts.
so you can take it in any way
To my knowledge, header function won’t submit the page.
Please clarify.
To allow our customers pay the shopping cart bill online,
All the creditcard validation can be done by paypal people.
Use function phpinfo() and you will get all detail regarding
your server as well as domain.
Data Definition Language – DDL
Data Manipulation Language – DML
There are two possible ways to bridge PHP and Java: you can
either integrate PHP into a Java Servlet environment, which
is the more stable and efficient solution, or integrate Java
support into PHP. The former is provided by a SAPI module
that interfaces with the Servlet server, the latter by this
Java extension.
The Java extension provides a simple and effective means for
creating and invoking methods on Java objects from PHP. The
JVM is created using JNI, and everything runs in-process.
Example Code:
getProperty(‘java.version’) . ”; echo ‘Java vendor=’ .
$system->getProperty(‘java.vendor’) . ”; echo ‘OS=’ .
$system->getProperty(‘os.name’) . ‘ ‘ .
$system->getProperty(‘os.version’) . ‘ on ‘ .
$system->getProperty(‘os.arch’) . ‘ ‘; // java.util.Date
example $formatter = new Java(‘java.text.SimpleDateFormat’,
“EEEE, MMMM dd, yyyy ‘at’ h:mm:ss a zzzz”); echo
$formatter->format(new Java(‘java.util.Date’)); ?>
The behaviour of these functions is affected by settings in
php.ini.
Table 1. Java configuration options
Name
Default
Changeable
java.class.path
NULL
PHP_INI_ALL
Name Default Changeable
java.home
NULL
PHP_INI_ALL
java.library.path
NULL
PHP_INI_ALL
java.library
JAVALIB
PHP_INI_ALL
IMAP:-( Internet Message Accese protocol) Port No is- 143
1.imap_list : Read the list of mailboxes
2. imap_open : Opens an IMAP stream to mailbox
3.after open the mail box one copy of the mail ll be a store
in server.
POP3 (Post Office Protocal) Port no-110
1.imap_list : Read the list of mailboxes
2.imap_open : Opens an IMAP stream to mailbox
3.After open the mail there ll be nothing in server.
LDAP:- (Light weight Directory Access protocol) port no-636
1. ldap_connect : This will connect to the ldap server with
the given login credentials.
2. ldap_search : By using this command we can search in ldap
records.
3.It is faster than other database like mysql,sql,oracle
4.It can write small amount of data but read becames faster.
5.Ex: outlook express