• Frequently Asked Questions (FAQ)- PHP-KeyCodes

  • PHP-KeyCodes

    This page has answers to some of the most common questions by people looking to purchase PHP-Keycodes and to sell digital license codes and pre-generated serial numbers. This is also a good place to start for those who are having problems with installation.

    Use this list to jump to the appropriate answer below:

    Do I have to enter anything into the PayPal site to identify the IPN url?

    Is PHP installed on my web server and what version do I have?

    My pages show fatal errors.

    Why do I keep getting error messages about headers already sent?

    I keep getting error messages about session_start

    I get an open_basedir error message

    Can I Send emails from a Windows server?

    Do I have to create a new database?

    How do I backup my PHPKeyCode site?

    Is there a shop cart system?

    Does it handle PayPal eChecks which may take days to clear?

    What knowledge and what facilities do I need?

    What do the admin emails mean?

    What do the mySQL error messages mean?

    How do I change the language code for PayPal?

    The admin pages keeps on returning to the login screen

    Sending html email using normal non-smtp PHP email system

    Do I have to enter anything into the PayPal site to identify the IPN url?

    You need to enable IPN on your PayPal account. Also you have to enter the IPN confirm web page. However, PHP-KeyCodes sends the confirm IPN web page to PayPal when an item is purchased and hence you can actually enter anything in to PayPal. This is because the IPN URL is part of the data sent to PayPal when the customer clicks on the buy now button.

    If you have set any IPN settings on the PayPal site, they will be overridden by the settings sent from PHP-KeyCode.

    The IPN system ensures that your key codes or mobile phone codes are securely sent only when a confirmed purchase is made.

    Is PHP installed on my web server and what version do I have?

    Make a new file on your web site called info.php, containing the following text, and call it from your browser:

    <?PHP phpinfo() ?>

    If nothing happens then you don't have PHP installed.

    My pages show fatal errors.

    If you see errors like:

    Parse error: parse error, unexpected T_VARIABLE in e:\phpfiles\withinweb\phpkeycode\config.php on line 13
    Notice: Undefined variable: dbhost in e:\phpfiles\withinweb\phpkeycode\admin\a_setup.php on line 154

    then it's likely you have left out a semi-colon or ending quote from a line in config.php.

    Another reason could be that you have opened config.php in a program like Word to edit it, and saved it as a HTML web page, instead of a proper text file.

    Always edit config.php with a text editor such as notepad or an editor designed to edit web pages such as Dreamweaver.

    Why do I keep getting error messages about headers already sent?

    If you see errors like this:

    Warning: Cannot add header information - headers already sent by (output started at /webfiles/phpkeycode/config.php:87) in /webfiles/phpkeycode/index.php on line 322

    then you probably have blank lines or spaces after the final ?> in your config.php file. Sometimes text editors add these so you may have to try a different text editor to remove these spaces or blank lines.

    I keep getting error messages about session_start

    If you see errors like this:

    Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in c:\webfiles\phpkeycode\setup.php on line 123
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\webfiles\phpkeycode\setup.php:1) in c:\webfiles\phpkeycode\setup.php on line 123

    These are all related to PHP failing to save "session" files on your server and you should contact your hosting company to investigate this.

    I have created a php file to test sessions. This is located in the admin folder at : http://www.yourservername.com/phpkeycode/admin/a_session_test.php.

    I get an open_basedir error message

    Your hosting provider or server administrator may have restrictions on which directories can use 'includes'. To check this, log into the administration section of PHP-KeyCodes and click on 'PHP info' link in the left hand side menu. This will display your site php info page. Find 'open_basedir' and check if the setting is something other than 'no value'. If it is something other than 'no value' then you might have to install PHP-KeyCodes in the directory shown. Check with your hosting provider.

    If a user is getting this error message on the screen when trying to download a file via the Download Link (i.e. after a sale), the open_basedir setting is preventing the PHP script from writing a temporary file that's needed for the download to happen. The solution is to have your server administrator or hosting provider change the open_basedir setting to 'no value'.

    Can I send email from Windows server?

    The best way to send email from a Windows server is to use smtp. The smtp settings are in the config.php file. Once set, all emails from the application will be sent using smtp.

    Do I have to create a new database?

    You don't have to create a new database if you don't want to. You could install the tables in an existing database providing that the table names do not clash with existing tables.

    All of my tables are prefixed with key_, so providing none of the existing tables have that prefix, there should be no problem.

    How do I backup my whole admin site?

    There are two things you need to make a copy of : the database with its data and the uploaded files on your web server. The admin scripts themselves are less important, since you should have the original files and any others you have modified to change the look of your displays.

    Your database can be backed up using the facilities of your web host.

    Is there a shop cart system?

    No. PHP-KeyCodes does not have a shopping cart system at the moment.

    Does it handle PayPal eChecks which may take days to clear?

    If someone purchases with an eCheck, you will receive an email saying that a purchase has been made, but at that point, as the check has not cleared, the customer will not get their login details. When the eCheck has cleared, the payment process continues and the customer will receive their login details.

    Do you host this product?

    No, you purchase the application and install it onto your own web server.

    What knowledge and what facilities do I need?

    Your system must meet the requirements of :

    • PHP 7 and 8
    • Apache web server
    • An SSL certificate on your web server to use https for communications with PayPal
    • MySQL database version 3.23 or higher
    • Linux, FreeBSD or Windows operating system on the web server
    • A Paypal Business or Premier account - sign up here.
    • Email functionality on the web server so that the PHP scripts can send out emails to customers.
    • If you are looking for a suitable host for you site, I would recommend the basic web hosting plan from siteground which has all the required features for this application.

    The application has been written to make it as easy to install as possible with minimum knowledge of PHP or mySQL. You need to be able to upload the files to your web server and to edit a configuration file with appropriate information.

    What do the admin emails mean?

    The application sends emails to the administrator for each transaction and most are self-explanatory. The following describes the less obvious ones :

    IPN - VERIFIED but incorrect Receiver_email address, no action taken - usually means that you have multiple email addresses in your PayPal account and you need to enter the primary PayPal email address into the Global Set Up admin section of PHP-KeyCodes.

    IPN - Error : Txn_ID has been duplicated - means that a previous transaction in the saleshistory table has the same txn_id which is an error. Although this is an error, it can occasionally happen with correct transactions and appears to be caused by the web server being slow or the internet being slow so that PayPal sends out another IPN before it receives an acknowledgement from your web server. In those situations the application does not register it as another sell, but just sends out a warning email saying that it has detected a duplicate txn_ID.

    What do the mySQL error messages mean?

    The following is a list of some of the mySQL errors that can occur and which may help if you are having problems connecting to the database.

    • Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'USERNAME@localhost' (Using password: YES) in /usr/home/..../test.php on line 8

      Your MySQL username/password is incorrect

    • Access denied for user: 'USERNAME@localhost' (Using password: YES)

      Your MySQL username/password is incorrect

    • Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host 'HOSTNAME' (1) in /usr/home/..../test.php on line 8

      Your MySQL hostname is incorrect

    • Could not connect: Unknown MySQL Server Host 'HOSTNAME' (1)

      Your MySQL hostname is incorrect

    • Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/home/...../test.php on line 8

      Your MySQL hostname is incorrect or you do not have the MySQL service started

    • Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

      Your MySQL hostname is incorrect or you do not have the MySQL service started

    • Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'mysql.domain.com' (60) in /usr/home/..../test.php on line 8

      Your MySQL hostname is incorrect or you do not have the MySQL service started

    • Could not connect: Can't connect to MySQL server on 'mysql.domain.com' (60)

      Your MySQL hostname is incorrect or you do not have the MySQL service started


    How do I change the language code for PayPal?

    The language code for the PayPal site is defined in the button using a hidden field.

    So for English language use

    <input type='hidden' name='lc' value='US' />

    Possible values are France(FR), Spain (ES), Italy (IT), Germany (DE), China (CN), English (US).

    The customer should then see the login page in the defined language.

    To change the language code, go to the file ipnfunction.php open in a text editor and you should see the default language code of

    <input type='hidden' name='lc' value='US' />

    Change the value to what ever code you require and upload the file back to your server.

    The admin pages keeps on returning to the login screen

    If you login to the admin pages and then click to go to a different page in the menu it returns to the login screen. This is becuase there is something wrong with your server session variables. The server stores the sessions and for some reason this is not being done correctly. You need to contact your hosting company to sort the problem out.

    There is a test at:

    http://www.yourservername.com/keycodes/admin/a_session_test.php

    Which will attempt to start the sessions. It will show a link that you click and should tell you if the session has been correctly started.

    Sending html email using normal non-smtp PHP email system

    You may want to send out your license codes using html email format. HTML format is built into the code and you can set it by selecting HTML format when you define the product.

    You will then have to put in some html formatting to make the display look the way you want.)