After installing WebSmart PHP you need to set a number of connection defaults so your programs can access your server and database. While there are a few ways to handle this requirement, the WebSmart PHP program templates are set up to retrieve the connection values from a file on your server. When you execute WebSmart PHP programs, the first thing they attempt to do is load a preferences file, xl_functions001.php, by executing this statement at the top of the code:
require('/esdi/websmart/v9.6/include/xl_functions001.php');
[Adjust this path to your own server files directory (instead of /esdi/websmart/v9.6/).]
This file includes a section where you can specify default user profiles and system names (among other things). However, because this file is overwritten when you upgrade, it in turn attempts to load some of the defaults from another file, xl_user_preferences.php, which you need to create. (see our online WebSmart PHP KB article 6998 for additional details).
Create xl_user_preferences.php
1. In your IBM i IFS open the file /esdi/websmart/v9.6include/xl_functions001.php (the release level may vary).
2. Save the file as xl_user_preferences.php (or copy and rename xl_functions.php).
3. In the new, copied file delete everything from (and including) this line up to the end of the file:
@include('xl_user_preferences.php');
Note: Leave the ?> at the end of the file!
4. In the section that remains in xl_user_preferences.php enter default values for the connections you will be using, as described here:
$pf_i5UserID and $pf_i5Password | IBM i user profile and password to use for all i5 connections. If this value is left blank, Zend Core will use the special profile 'NOBODY'. Note that these values are only necessary if your applications will use the i5-specific PHP functions. |
$pf_i5IPAddress | Unless you are by default connecting from your IBM i to another one, use the loopback value 127.0.0.1 here. |
$pf_db2SystemName | Enter your IBM i system name for all database file access. |
$pf_db2UserID and $pf_db2Password | IBM i user profile and password to use by default for all DB2 access. |
$pf_mysqlUrl | Default MySQL server to connect to. |
$pf_mysqlUserId and $pf_mysqlPassword | Default MySQL server user profile and password. |
$pf_mysqlDataBase | Default MySQL database. |
When you create your own application you may want to load your User IDs another way (for example, by prompting the user to enter one), but this approach will get you started.
|