Categories
linux PHP Technology

How to debug if phpinfo() is Disabled ?

Some server (hosting) providers choose to disable the PHP function phpinfo() for security reasons or say vulnerability in PHP 5.3 CVE-2014-4721, because it displays information which can be used to compromise the server that your site is running on. phpinfo() outputs almost every information about PHP’s configuration, such as the values of PHP directives, loaded extensions and environment variables.

In cases where phpinfo() is disabled, debugging problems in PHP is much more difficult. But, even though phpinfo() is disabled, you can still find that information using php’s core functions:

<?php
//PHP directives
echo ini_get(upload_max_filesize); // 2M

//Extensions/modules
print_r(get_loaded_extensions());

//Environment variables
print_r($_ENV);

//PHP or extension version
echo phpversion(); // 5.3.26
echo phpversion('pdo_mysql'); // 1.0.2
?>

In case you have SSH access to the server, “php -i” can also be used to get PHP configuration settings. For example, to get the configuration for the PDO – MySQL extension:

$ php -i|grep pdo_mysql

Or to get the version of PHP:

$ php -v

Though you can get lot of information without need of enabling phpinfo() but still if you want to enable it, learn “How to Enable and disable phpinfo()“.

'Coz sharing is caring
Categories
PHP Technology

Credit Card Numbers for Payment Gateway Testing

I recently developed a site that utilized a merchant gateway. I had the gateway in “Test” mode so i could process fake transactions to ensure the system was working properly.

The only fake credit card number I could use was 4111111111111111 which is denoted as a VISA card.

Anyhow, I wanted to make sure I could test with other numbers so I tried putting in random 16 digit numbers. Doing so caused the gateway to return an error, “Invalid Credit Card #”

The reason for this is because the credit card number was not a Mod-10 Credit card number. Mod-10 is used to validate credit card numbers.

Anyhow, here are 2 credit card numbers that you can use for credit card testing when interacting with a payment gateway in test mode:

1. 4111111111111111
2. 4111111111111103

How it verify Mod-10:

1. Take a credit card number and reverse it: 1111111111111114

2. Now multiple each even digit by 2.

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4
_ 2 _ 2 _ 2 _ 2 _ 2 _ 2 _ 2 _ 2

Which is: 2+2+2+2+2+2+2+8 = 22

Note:If any results from your multiples of 2 are 2 digits or greater, then split the digits and add them together
So if 2×6=12 you would add (1+2) not 12
2+2+2+2+ (1 + 2)…

3. Now add the odd digits to 22, 22 + 1 + 1 + 1 +1 +1 +1 + 1 + 1 = 30

4. Now divide by 10

30/10 = 3

Since there is no remainder the card number is Mod-10. If there is a remainder, then the card # is NOT Mod-10

Now with this method you can come up with your own Mod-10 Numbers for testing.

The CVV can be used as 123

'Coz sharing is caring