Home >Backend Development >PHP Tutorial >Connection and use of PHP and Sybase database

Connection and use of PHP and Sybase database

不言
不言Original
2018-04-09 09:39:562679browse

The content of this article is to share with you the connection and use of PHP and Sybase database. It has certain reference value. Friends in need can refer to it.

Question: Regarding the connection and use of PHP and Sybase database Using
Answer:

I am very happy to see that everyone is using Sybase. Many netizens have encountered problems when using the php_sybct.dll module of this website.
The netizens’ questions are now explained as follows:

1. Pay attention to your PHP version. I only use the official PHP source code (http://php.net) to compile PHP. Moreover, in PHP4, I found that
each version has slightly different Difference (mainly related to ZEND), so PHP4 modules strictly distinguish PHP versions, and PHP4RC1 modules may not be used in PHP4.0.0. Some netizens use the PHP compiled version of swwwing.com company, I cannot guarantee that you will be able to Use this
module.
2. Configure your PHP correctly, ensure that your machine has only one php.ini in the path that the system can traverse, and configure it correctly. The recommended
approach: Replace php_sybct.dll Copy to the directory where php4 is located, such as c:/php4, modify extension_dir=c:/php4 in php.ini (usually located in the Windows directory or
WinNT directory) and add extension=php_sybct.dll. Note that there should be no spaces on both sides of the = number.
Grid; run php_info(); and check the PHP output information. If the sybase_ct information is found, it proves that the module is loaded successfully. Otherwise,
your PHP version does not match this module. In fact, the simplest way is to see if there is any ' ' Support for Client
DLL. Use SQLEDIT to add a data service to the Web database (of course, this is not necessary, you can use the existing
data service) SybWeb. After filling in the configuration parameters correctly, save and exit. Use SybasePing Tool to ensure that the SybWeb service can
ping the Sybase Server.
4. Write PHP code, connect to the database, use sybase_pconnect("SybWeb", "sa", "sapass"); //sapass is used for sa
user's connection password. Sybase will prompt information such as "changed database to master...". If you want to block this information, you can add '@' before the function, sybase_select_db ("Your DataBase Name") function '@' should also be added before.
5. Other issues:
*About illegal operations
One of them may be related to the local machine, such as the Sybase Client is not installed correctly, or there is a problem with the Win9x system. You can transplant it Go to WinNT
and try;
The second one may be related to the Sybase Client version. I used SybaseCT Version 11.0.2 to compile this module. Later, some netizens provided Version 11.9.2. I will use it in PHP4 .0.1 (inclusive) and later versions. Just like MSSQL has 65 and 70, Sybase will also have version distinctions. I have sent this module to many foreign netizens, and they use it normally. I I think it’s because
foreigners are not as fashionable as Chinese people and use the latest version of everything.
*About the connection to Sybase under Linux or UNIX
I have not used Sybase under the two systems, so I cannot test it. However, there are netizens at home and abroad who have used this module to successfully establish a connection with
Sybase for Lunix. I think they are all based on TCP/IP, which is not surprising. However, it should be noted that the SybWeb service at this time should
Based on TCP/IP (NLWNSCK) instead of named pipe (NLMSNMP).
*About Sybase SQL Any Where
Some netizens use this module to connect to Sybase SQL Any Where, which is a miniaturized desktop-based version of Sybase The database
system may not be able to use this module.


I use Win98 Apache1.3.12 Sybase system 11 (Client) PHP4.0.0 for development;
The database is WinNT4 Sybase system11;
Web Server is Apache1.3.12 (running on WinNT) PHP4.0.0, which is temporarily on the same machine as the database Server;
has been used normally.
Related recommendations:


Querying SQL in PHP Solution to TEXT field being truncated in Server or Sybase_PHP Tutorial


The above is the detailed content of Connection and use of PHP and Sybase database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn