PHP

/Tag:PHP

Centos: PHP Fatal error: Class ‘SoapClient’ not found in

You may get an error returned from error log (example from CentOS): PHP Fatal error:  Class 'SoapClient' not found in   Create a php file (e.g. info.php) with the following code in your server : <?php phpinfo();?>   Access to the page (e.g. http://yourdomain.com/info.php) and check whether the soap is installed and enabled Or You [...]

By | January 7th, 2016|IT Knowledge Base|0 Comments

How to solve SQLSTATE[HY000] [2002] No such file or directory

Sometimes a MySQL PDO error message below would be got SQLSTATE[HY000] [2002] No such file or directory The error message may be shown due to the line below $db = new PDO('mysql:host=localhost;dbname=db_name;charset=utf8', 'username', 'password'); What's going on? Try to change "localhost" to "127.0.0.1" $db = new PDO('mysql:host=127.0.0.1;dbname=db_name;charset=utf8', 'username', 'password');   The error message should then [...]

By | February 20th, 2015|IT Knowledge Base|0 Comments

How to connect MSSQL in PHP on Linux

You may want to connect to your Microsoft SQL database (MSSQL) by the applications in your Linux server. This article describes the steps to install the php modules php-mssql on CentOS 6 with PHP 5.3   Step 1 - Install required packages (freetds and php-mssql) The module php-mssql is not in the default repository.  So [...]

By | November 25th, 2014|IT Knowledge Base|0 Comments

How to add days, weeks, months to any date in PHP?

You may want to add dates to a specific date by using PHP codes. The following codes show how to add days, weeks and months to a date variable. Units can be used: day, days, week, weeks, month, months, year, years […]

By | May 7th, 2014|IT Knowledge Base|0 Comments

Setup a new CentOS (Apache, PHP, MySQL, phpMyAdmin, Sendmail)

After the installation of a new CentOS platform, you can follow the steps in this article to setup some important configurations and install some important services. e.g. resetting the root password, set the server local time, install apache, mysql, php, php-mysql, sendmail services and so on. […]

By | May 7th, 2014|IT Knowledge Base|0 Comments

PHP Replace Some Characters

Some personal information would like to be confirmed by users or customers by displaying a part of the details. For example, visa card number, ID card number, email, phone number, etc. Sometimes only a few characters would be shown and other characters would be replaced by *. The followings are two examples to replace some [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments

Format of Numbers in PHP

To set the format of numbers in PHP, you can use the function number_format. You can set the pattern, separator of the decimal point and separator of thousands by using this function. $number = 12345.67; // The default pattern echo number_format($number) . "<br>"; // Output: 12,346 // Set the number of decimals echo number_format($number,4) . "<br>"; [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments

Fatal error: Allowed memory size in PHP

In your web based system written in PHP, some pages may display many data or provide upload functions. It may display a blank page after loading for a long time. Then you can use the following codes to display the error: error_reporting(E_ALL); ini_set('display_errors', TRUE); Sometimes the page displays a blank page because the memory limit is reached. And the error [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments