Very simple to set up. I got it up and running in moments. I even install the php5-ldap so GLPI connects to an ldap server for your users. This tutorial takes a quick look at some of the most commonly used commands to check hardware information and configuration details on Linux. How to Compile PHP with IMAP Support. Internet message access protocol (IMAP) is one of the two most prevalent Internet standard protocols for e- mail retrieval. This shows you how to enable IMAP extension in PHP. First, grab the latest c- client library from this website. In this example, I’m using imap- 2. Copy the source to a directory, e. I’m using Red. Hat Enterprise 5, so the port will be lr. Once you have the port name, you can compile it. ![]() You will have to create additional directories named lib/ and include/. From the c- client directory from your IMAP source tree, copy all the *. Additionally when you compiled IMAP, a file named c- client. Also put this in the lib/ directory but rename it as libc- client. You have to compile PHP to enable IMAP support. I’m using PHP 5. 3. If you have compiled PHP before, you have to remove “config. If you have any questions, please post in the comment. Accessing Microsoft SQL Server (mssql) from PHP under Apache on UNIX or Linux. Accessing Microsoft SQL Server (mssql) from PHP under Apache on Unix or Linux. PHP is an open- source scripting language used to create database- driven web applications. PHP supports a number of database extensions that enable PHP scripts embedded within web pages to access data stored in relational databases and display the results. PHP includes ODBC support through its Unified ODBC database extension. This tutorial shows you how to use ODBC to access remote SQL Server databases from PHP scripts running under the Apache web server. Connect PHP to SQL Server 2. SQL Server 2. 00. SQL Server 2. 00. SQL Server 2. 01. SQL Server 2. 01. SQL Server 2. 01. SQL Server Express. When developing this tutorial, we accessed SQL Server 2. Express databases from PHP on UNIX and Linux. PHP and Linux. To access SQL Server from PHP on Linux, we used Easysoft ODBC drivers with PHP on Red. Hat and Ubuntu (Edgy Eft, Feisty Fawn, Gutsy Gibbon and Hardy Heron). Easysoft ODBC drivers should work with any recent 3. Linux distribution—Cent. OS, Debian GNU/Linux, Fedora, Kubuntu, Mandrake/Mandriva, Open. SUSE/SUSE, Red. Hat Enterprise Linux (RHEL), Slackware and so on. PHP SQL Server Pre- requisites. To connect PHP on UNIX/Linux with SQL Server, we used: PHP 4. Later. To check which version of PHP you are running, use the php - v command from the shell prompt. If you get a . If PHP is installed, you should see something like . Documentation and installation instructions can be found both in the README that is included in the distribution and at http: //www. We tested Easysoft ODBC drivers with PHP 5. PHP 5. 3. 1. 0, PHP 5. PHP 4. 2. 2. Installing PHPWe used a package manager to install PHP on our Linux client machines. A package manager is a program that installs and uninstalls software, and keeps track of the components each piece of software needs. On Ubuntu, we used the Synaptic package manager to install PHP. On Red. Hat, we used the redhat- config- packages package manager to install PHP from RPMs. Installing PHP from Packages on Ubuntu. On the System menu, choose Administration, and then choose Synaptic Package Manager. Type the administrative (sudo) password when prompted. In Synaptic Package Manager, mark php. The phpinfo function displays extensive configuration information about PHP and the system on which PHP is running. To create this PHP script, you need to do something like this: Create a file called phpinfo. Add these lines to phpinfo. This is a simple one liner that amongst other things returns relevant PHP information< ? Save this file, and then from the command line, type. This redirects the output from phpinfo into an HTML file called newhtmlfile. Apache 2. 0 or Later. When developing this tutorial, we ran PHP under Apache 2. Apache 2. 2 and Apache 2. To find out which version of Apache you are running, enter the following command at the shell prompt: httpd. For example, on Linux, the default location is normally /usr/sbin. The - V option displays information about the Apache installation. For example: Server version: Apache/2. Ubuntu). Server built: Oct 4 2. Server's Module Magic Number: 2. Server loaded: APR 1. APR- Util 1. 2. 7. Compiled using: APR 1. APR- Util 1. 2. 7. Architecture: 3. Server MPM: Prefork. Server compiled with.. You can also run the example PHP scripts from the shell prompt. SQL Server ODBC Driver. We used our UNIX/Linux ODBC driver for SQL Server 7. Express to connect PHP to remote SQL Server databases. Download the SQL Server ODBC driver for your PHP client platform. The ODBC- ODBC Bridge is an alternative SQL Server solution from Easysoft, which you can download from this site. Install and license the SQL Server ODBC driver on the machine where PHP is installed. Refer to the documentation to see which environment variables you need to set (LD. For example, this SQL Server ODBC data source connects to a SQL Server Express instance that serves the Northwind database. For example. cd /usr/local/easysoft/unix. ODBC/bin. ./isql - v MSSQL- PHPAt the prompt, type . To exit, press return in an empty prompt line. Examples: How to Connect PHP with SQL Server and Retrieve Data. The following PHP script accesses a remote SQL Server database, selects and then fetches some test data. Use it to check that you can successfully access your SQL Server instance from a PHP script. Remember to replace the data. For example, /var/www/apache. Then view the file in a web browser. If your web browser is not running on the same machine as the web server, replace localhost with the web server’s host name or IP address. To run the script from the command line, save the file. For example, /tmp/php- mssql- connection. Then run $ php /tmp/php- mssql- connection. PHP MSSQL Example. Replace data. To run this script: Copy the script shown below into a new file. Replace data. For example, /var/www/apache. MSSQL PHP Example - - Table List< /title> < /head> < body> < ? This script will list all the tables in the specified data source. Replace datasource. The script is wrapped in HTML therefore and is intended to be run under the Apache web server. If you want to run the script from a shell prompt: Copy the script shown below into a new file. Replace datasource. For example, /tmp/mssql- php- retrieve- data. Run the script from the command line. For example $ php /tmp/mssql- php- retrieve- data. MSSQL PHP Example. This script will list all the tables in the specified data source. Replace datasource. The data source that you specify in the scripts needs to connect to this database. Here is a simple procedure that runs a SELECT statement and returns the results.< ? MSSQL PHP Example. Replace datasource. PDO was initially released as an extension for PHP 5. PHP Extension Community Library (PECL). PDO is included in PHP 5. Because PDO requires the object oriented features introduced in PHP 5. PHP. PDO supports: Prepared statements and bound parameters. Transactions. Large objects (LOBs). SQLState error codes. Scrollable cursors. The PDO architecture has two levels. The top level, PDO, provides a database independent interface for interacting with databases. The lower level consists of database- specific drivers, which translate between the top level interface and the relevant database interface (for example, ODBC or OCI). The PDO architecture insulates your PHP applications and scripts from database- specific details letting you switch from one database to another without having to change your PHP code. The PDO. For information about installing the SQL Server ODBC driver, see earlier in this tutorial. Installing PDO and PDO. When testing on Ubuntu Linux, we installed the following packages: Package. Notesphp. 5- cli. Enables PHP scripts to be run standalone. Automatically supports PDO. Includes the PDO. Installs PDO. The libodbc. ODBC libraries and is a dependent package of php. Apache HTTP server. This is the non- threaded version as libapache. Apache (apache. 2- mpm- worker). PHP module for Apache. Automatically supports PDO. Enables PHP to be run under Apache. The Apache HTTP server was automatically configured to load this module and use this module for pages with a . No additional configuration was necessary. Building from Source. By default, PDO is automatically built into the PHP 5. PHP build system to get PDO support. To build PDO. To do this, set the - -with- pdo- odbc option's value to unix. ODBC. To build PDO. By default, the PHP build system expects unix. ODBC to be installed under /usr/local. The unix. ODBC Driver Manager included in the SQL Server ODBC driver distribution is installed under installation. To build PDO. To build PDO. To do this, add the following line to php. Specify the directory where your Apache executables are located in - -with- apxs. For example, - -with- apxs. For example: $dbh= new PDO('odbc: MY. If you specify just the PDO. For example: $dbh= new PDO('MSSQL'); ; PDO. If the configure line does not contain the - -with- pdo- odbc option, PDO. If the - -with- pdo- odbc option value contains shared, check that php. PDO. A RETURN statement enables a stored procedure to return an integer value, which reports the execution status of the procedure. Output parameters enable procedures to return other types of values, for example, character strings. PDO, unlike the Unified ODBC extension, provides direct support for output parameters. This section contains an example that calls a stored procedure from PHP and retrieves an output parameter value. The user you specify for theconnection needs to be able to create procedures in thisdatabase. Replace < DSN> with the name of your ODBC data source.*/$dsn=. The YTD sales are returned with an output parameter. You need to have installed: PHP The minimum version required. The ODBC- ODBC Bridge Client The ODBC- ODBC Bridge Client is an ODBC driver that talks to the ODBC- ODBC Bridge Server and therefore your remote ODBC data source. You need to install the ODBC- ODBC Bridge Client and the unix. ODBC Driver Manager. ODBC- ODBC Bridge distributions include the unix. ODBC Driver Manager. There is no need to install the ODBC- ODBC Bridge Server on this machine. Refer to the ODBC- ODBC Bridge manual for installation instructions. Server machine. This is the machine where you have (or can install) an ODBC driver for the database you want to access. You need to have installed: ODBC driver For this tutorial, you need the Microsoft SQL Server ODBC driver, and it is available in Microsoft Data Access Components (MDAC), the Microsoft SQL Server Native Client and the Microsoft SQL Server 2. Native Client. You do not need install the MS SQL Server ODBC driver on the same machine as your SQL Server database. The ODBC- ODBC Bridge Server. The ODBC- ODBC Bridge Server is an ODBC application, which accepts connections from the ODBC- ODBC Bridge Client and relays them to your target ODBC data source. You need to license the ODBC- ODBC Bridge Server, and trial licenses may be obtained during the installation.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |