|
Frequently Asked Questions
|
   
|

|
This is a list of Frequently Asked Questions about PHP3 and
their answers. If you have suggestions or additions, send them to
php3@lists.php.net.
- 1. General Information
- 2. Obtaining PHP3
- 3. Installation
- 4. Common Problems
- 5. Using PHP3
- 6. New Features
- 7. Common Problems
- 8. Migrating from PHP2 to PHP3
1. General Information
-
1.1 What is PHP3?
-
From the manual:
PHP Version 3.0 is an HTML-embedded scripting
language. Much of its syntax is borrowed from C, Java and Perl with a
couple of unique PHP-specific features thrown in. The goal of the language
is to allow web developers to write dynamically generated pages quickly.
-
1.2 What is its relation to PHP/FI?
-
PHP3 is the successor to PHP/FI 2.0.
-
1.3 Can I run both PHP/FI 2.0 and PHP3 at the same time?
-
Yes, PHP3 was written so as to not interfere with an existing PHP/FI 2 installation.
Instructions for building Apache 1.3.0 with both PHP/FI 2 and PHP3 modules can be
found HERE. A different spin on this is
HERE, although the first step where
the PHP2 regex code is substituted with the PHP3 regex code seems redundant. The
two regex dirs are pretty much identical.
-
1.4 What are the differences between PHP3 and PHP/FI 2.0?
-
For a complete list of the changes, read the CHANGES file included in the PHP3
distribution. Some highlights:
- All-new parser.
- Persistent database connections.
- A native Windows95/NT port.
- IMAP, SNMP, and LDAP extensions.
-
1.5 I heard it's possible to access Microsoft SQL Server from PHP3. How?
-
On Windows 95/NT machines, you can simply use the included ODBC support
and the correct ODBC driver.
On Unix machines, you can use the Sybase-CT driver
to access Microsoft SQL Servers because they are (at
least mostly) protocol-compatible. Sybase has made a free version of the necessary
libraries for Linux systems. For other Unix operating systems,
you need to contact Sybase for the correct libraries. Also see
the answer to the next question - 1.6.
-
1.6 Can I access Microsoft Access databases?
-
Yes. You already have all the tools you need if you are running
entirely under Windows 95/98 or NT, where you can use ODBC and Microsoft's
ODBC drivers for Microsoft Access databases.
If you are running PHP on a Unix box and want to talk to MS-Access on
a Windows box you will need Unix ODBC drivers.
OpenLink Software has Unix-based
ODBC drivers that can do this. There is a free pilot program where you
can download an evaluation copy that doesn't expire and prices start at
$675 for the commercial supported version.
Another alternative is to use an SQL server that has
Windows ODBC drivers and use that to store the data, which you can
then access from Microsoft Access (using ODBC) and PHP3 (using the
built-in drivers), or to use an intermediary file format that Access
and PHP3 both understand, such as flat-files or dBase databases.
On this point Tim Hayes from OpenLink software writes:
Using another database as an intermediary is not a good idea, when you can
use ODBC from PHP3 straight to your database - i.e. with OpenLink's drivers. If
you do need to use an intermediary file format, OpenLink have now released
Virtuoso (a virtual database engine) for NT, Linux and other unix platforms.
Please visit our
website for a free download.
One option that has proven successful is to use MySQL and its
MyODBC drivers on Windows and synchronizing the databases. Steve Lawrence
writes:
- Install MySQL on your platform according to instructions with MySQL.
Latest available from www.mysql.org (get it from your mirror!). No special
configuration required except when you set up a database, and configure the
user account, you should put % in the host field, or the host name of the
windows computer you wish to access MySQL with. Make a note of your server
name, username, and password.
- Download the MyODBC for windows driver from the MySQL site. Latest
release is myodbc-2_50_19-win95.zip (NT available too, as well as source
code). Install it on your windows machine. You can test the operation with
the utilities included with this program.
- Create a user or system dsn in your ODBC administrator, located in the
control panel. Make up a dsn name, enter your hostname, user name, password,
port, etc for you MySQL database configured in step 1.
- Install Access with a full install, this makes sure you get the proper
add-ins.. at the least you will need ODBC support and the linked table
manager.
- Now the fun part! Create a new access database. In the table window right
click and select Link Tables, or under the file menu option, select Get
External Data and then Link Tables. When the file browser box comes up,
select files of type: ODBC. Select System dsn and the name of your dsn
created in step 3. Select the table to link, press ok, and presto! you can
now open the table and add/delete/edit data on your MySQL server! You can
also build queries, import/export tables to MySQL, build forms and reports,
etc.
Tips and Tricks:
- You can construct your tables in access and export them to MySQL, then
link them back in. That makes table creation quick.
- When creating tables in access, you must have a primary key defined in
order to have write access to the table in access. Make sure you create a
primary key in MySQL before linking in access.
- If you change a table in MySQL, you have to re-link it in access. Go to
tools>add-ins>linked table manager, cruise to your ODBC DSN, and select the
table to re-link from there. you can also move your dsn source around there,
just hit the always prompt for new location checkbox before pressing ok.
-
1.7 Is there a PHP3 mailing list?
-
Of course! To subscribe, send mail to
php3-subscribe@lists.php.net . You don't need to include
anything special in the subject or body of the message.
To unsubscribe, send mail to php3-unsubscribe@lists.php.net .
-
1.8 Help! I can't seem to subscribe to the mailing list!
-
Help! I can't seem to unsubscribe from the mailing list!
-
If you have problems subscribing to or unsubscribing from the
PHP3 mailng list, it may be because the mailing list software
can't figure out the correct mailing address to use. If
your email address was
joeblow@example.com ,
you can send your subscription request to
php3-subscribe-joeblow=example.com@lists.php.net ,
or your unsubscription request to
php3-unsubscribe-joeblow=example.com@lists.php.net .
-
1.9 Is there an archive of the mailing list anywhere?
-
Yes, you will find a list of archive sites on the Support
page.
-
1.10 How did you do those pop-out windows for the Search and Mirror buttons?
-
Our site designer, Colin Viebrock (cmv@privateworld.com), says:
Those fancy pop-out layers are done with Dynamic HTML (DHTML), Cascading Style Sheets (CSS) and Javascript (version 1.2).
There are plenty of references on the web about DHTML and CSS, including:
But your best source of information is to view the source code to the pages on the PHP site.
To see the actual DHTML/Javascript code, use your browser's "View Source" function. To see how this code was
generated dynamically using PHP3, click on the "Source" button in the upper-right corner of any PHP page. You
will probably also want to view the source of the "shared.inc" file - there is a link to it at the bottom of every
source page.
-
1.11 Can I access Empress RDBMS databases?
-
Yes. PHP 3.0.6 and Empress RDBMS v8.10 and higher are compatible.
You already have all the tools you need if you are running entirely under
Windows 95/98 or NT, where you can use ODBC and the Empress ODBC driver for
Windows.
If you are running PHP on a Unix box and want to access Empress databases, you
can link
the Empress ODBC client driver directly into the PHP unified ODBC API.
Note that does NOT make PHP an ODBC client. The unified ODBC interface
simplies uses the ODBC application program interface (API).
Because Empress uses the PHP unified ODBC interface it has very little explicit
Empress specific syntax. It is of course possible to use Empress specific SQL
in the SQL statements themselves, but this does not affect the interface.
It is a good general policy to stick to ANSI standard SQL whenever
possible.
- Empress Specifics: The only item which is specific to Empress in
PHP is that there are two methods for specifying the DNS in the
odbc_connect () and odbc_pconnect () functions.
The connect syntax is:
odbc_connect (dsn, user_id, password)
odbc_pconnect (dsn, user_id, password)
For Empress dsn can be specified as either:
- Data source name
- This is the logical database name specified in the ODBC.INI file.
- A full connection string, as specified in the ODBC standard.
-
eg
dsn="DATABASE=db_name;SERVER=server_name;PORT=server_port"
Note that there are other options for this string. But the three shown
above are the most important for use with PHP.
Which of these you use is up to you. There are advantages and disadvantages to both.
Using the full connection string means that you do NOT require an ODBC.INI file
to access the database. However, if you move the datasource, or change the port on
which the RDBMS server listens, you will have to modify every call to the
odbc_connect/pconnect function.
The choice is yours...
- Empress Installation:
In order to add the Empress interface to PHP you require an Empress RDBMS with
the Empress Connectivity option. If your PHP installation is on the same
platform as the RDBMS then setting EMPRESS_PATH to the installation directory
will automatically locate the Empress ODBC client driver. However, if the
PHP installation is on a separate platform from the RDBMS you will also
require an ODBC client on that platform, and you will need to specify the
location of the driver when configuring the PHP installation.
| |