Tag Archives: php

PHP connection PostgreSQL error call to undefined function PG_ connect()

Use PHP to connect PostgreSQL, Call to undefined function pg_connect();
‘PDOException’ with message ‘could not find driver’ with message ‘could not find driver’
Testing environment:
First, the extension=php_pdo_pgsql.dll and extension=php_pgsql.dll extensions are on, but not working.
Then, add \PostgreSQL\bin to the environment variable, which still doesn’t work.
Then, putting \PostgreSQL\bin\libpq.dll into System32 has no effect.
Finally, change libpq.dll from \ PHP \php5.*\ into \apache*\bin to solve the problem.

SQL Server “login failed for user ‘domain account”. [sqlstate 28000] (error 18456). “Problem solving

Problem: SQL Server 2014, synchronized data from Linked Server with Job timing, executed times “Login Failed for User ‘domain account’ “(SQLSTATE 28000) (Error 18456).
Solution: Modify the SQL Server Agent service startup account as the domain account through the configuration management tool, see: Login Failed for [SQLSTATE 28000] (Error 18456) The Step Failed

Reproduced in: https://www.cnblogs.com/abelard/p/4840962.html

Composer install ThinkPHP

1. There is no download of Composer. We only need to download Composer- setup. exe (for the Window platform) and install it step by step.
Note the following step, using my phpstydy integrated environment as an example, to select the path to install:

2. After the installation is successful, we can check whether the installation is successful by typing the Composer – Version command through the command window (CMD)
3. Open a command line window, enter the following command:
composer config - g repo. Packagist composer https://mirrors.aliyun.com/composer/
4. If this is your first installation, under the command line, switch to your WEB root and execute the following command:
composer create-project topthink/think=5.1.* tp5.1
5. Wait for installation to complete

After upgrading php7, PHP program prompts an error: operator not supported for strings in causes and Solutions

PHP Fatal error: [] operator not supported for strings in…
 
After searching the information, I found that it was caused by the following reasons
 
When a variable is assigned a second time in the same page, but the inconsistent type of the value causes this error, the variable type can be declared again before the second assignment.
Simply put, it is the result of different types of assignments to the same variable on the same page.
 
Such as:
$a = “ABC”;
$a [] = “def”;
 
The solution
 
To check if your code has the way it was written in the above example, declare a variable once before each assignment or destroy it with the unset() function
 
Ex. :
$a = “ABC”;
unset($a);
$a [] = “def”;

Fatal error: Call to a member function bind_param() on a non-object in

Fatal error: Call to a member function bind_param() on a non-object in. Fatal error: Call to a member function bind_param() on a non-object in
1. Error code: $STMT =$this-> mysqli-> prepare($query); // Preprocessed statements
2. Check the code, there is a place that could go wrong: $query, find the SQL statement
$query = “update product set name =?,price=?,description=?where productId=?” ;
Take a closer look at the statement, oh, suddenly, ok?There is no space between where, smart you see it?
Solution: SQL statement error, view SQL statement. Keywords, table names, column names…

Reproduced in: https://www.cnblogs.com/Theladyflower/p/3245893.html

PHP Error

I encountered this error while using the thinPHP framework is_array function today. You cannot use the return value of a function as an argument

Baidu solution is thinkPHP bug, more reliable said that the PHP version of the problem, 5.4 not, 5.6 is OK, but I use the version of 5.6.

The solution, is_array,empty, is to pass as many variables as possible.

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in E:\WWW\blog\hyii2\frontend\web\index.php

Yii2.0.32. Advanced Templates.
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in E:\WWW\blog\hyii2\frontend\web\index.php on line 17
https://www.imooc.com/qadetail/189883
This is a syntax error,
The first thing you need to do is check the file E:\WWW\blog\hyii2\ Frontend \ Web \index.php for syntax errors on line 17
If you haven’t touched this file, chances are your VERSION of PHP doesn’t meet the requirements
Yii2 requires at least 5.4 PHP versions

Syntax error or access violation: 1071 specified key was too long; max key length is 767 bytes

Laravel 5.4 has made a change to the default database character set and now utf8mb4 which includes support for storing emojis. This only affects new applications, and as long as you’re running MySQL V5.7.7 and later, you don’t need to do anything.
For users running MariaDB or older versions of MySQL, you may encounter this error when trying to run the migration:

[Illuminate \ Database \ QueryException] SQLSTATE[42000]: Syntax Error or Access Restriction: 1071 Specified key was too long; Max key length is 767 bytes (SQL: alter table users add uniqueusers_email_unique (email)
[PDOException]
SQLSTATE [42000] : syntax error or access conflict: 1071 specified key is too long; The maximum key length is 767 bytes

As described in the migration guide, to solve this problem, you simply edit the AppServiceProvider. PHP file and set the default string length within the boot method:

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

After that, everything should work normally.
(PS: The exception explicitly indicates that the maximum length is 767 bytes, and utF8MB4 encodes 4 bytes per character, so 767/4 = 191.75, so set the default length of string to 191 characters. I hope it helps.)

Disk BLK_ update_ request: I/O error

1. Try 1:
Blk_update_request: I/O error, dev fd0, Sector 0 error resolved

Reference document:

https://bbs.archlinux.org/viewtopic.php?pid=1166918#p1166918
http://www.cyberciti.biz/faq/linux-end_request-ioerror-dev-fd0-sector0/

blk_update_request: I/O error, dev fd0, sector 0 when booting Linux on hardware with floppy drive controller on
Resolve the error message by closing the floppy drive module:
#
# /etc/modprobe.d/modprobe.conf
#
blacklist floppy
Try 2:

< strong> When dMESg occurs, the following message indicates a problem with the disk. /strong> < br> < br> Info fld=0x139066d0

end_request: I/O error, dev sda, sector 328230608

The I/O error Buffer
The on
device sda, logical block 41028826

sd 0:0:0:0: SCSI error:
The return
code = 0x08000002

sda: Current: sense key: Medium Error


Add. Sense: Unrecovered read error

 

Info fld=0x139066d0

end_request: I/O error, dev sda, sector 328230608

The I/O error Buffer
The on
device sda, logical block 41028826

sd 0:0:0:0: SCSI error:
The return
code = 0x08000002

sda: Current: sense key: Medium Error


Add. Sense: Unrecovered read error

 

Info fld=0x139066d0

end_request: I/O error, dev sda, sector 328230608

The I/O error Buffer
The on
device sda, logical block 41028826

sd 0:0:0:0: SCSI error:
The return
code = 0x08000002

sda: Current: sense key: Medium Error


Add. Sense: Unrecovered read error

 

Info fld=0x139066d0

end_request: I/O error, dev sda, sector 328230608

The I/O error Buffer
The on
device sda, logical block 41028826

sd 0:0:0:0: SCSI error:
The return
code = 0x08000002

sda: Current: sense key: Medium Error


Add. Sense: Unrecovered read error

1. First detect the failure
Badblock-s-v-o /root/bb.log /dev/sda save the results to bb.log

[root@logging ~]# badblocks -s -v -o /root/badblocks.log /dev/sda
Checking blocks 0 to 586061784
Checking for bad blocks (read-only test): done                                
Pass completed, 173 bad blocks found.

 
Smartctl-a /dev/sda3 (Quickly detect errors after read and write)
2. Repair method of logical bad path

, badblock-s-w /dev/sda END START (END stands for the END of the sector to be repaired, START stands for the beginning of the sector to be repaired)
, fsck-a /dev/sda
After the repair, badblock-s-v-o /root/bb.log /dev/sda will be used to monitor for bad tracks. If there are bad tracks, it is a bad hard drive. Hard disk bad way to use the isolation method, first of all, the monitoring of the hard disk bad way and then partition when the hard disk bad way in the sector is divided in a partition (size is generally greater than the size of the bad sector), the partition of the bad way partition can achieve the purpose of isolation
3. 0 Bad track and hard drive (ready to replace hard drive)
The repair method of bad track of 0 track is to isolate track of 0 track. When using FDSK to divide the area, divide the area from track of 1.
If it's a bad drive, it can only be quarantined and not repaired
 

Reproduced in: https://www.cnblogs.com/wangjq19920210/p/9238910.html

Call to undefined function oci_ Connect() problem solving

Call to undefined function Oci_connect () issue resolved

Important: Make sure that PHP is the same version as the Oracle client that you want to install. It must be both 32-bit and 64-bit, or the OCI extension will not be available

1. View the PHp.ini configuration file:

A. Open the module path setting: view; Extension_dir = “ext” or “ext”; , and change the quotes to “PHP installation path \ext”, such as extension_dir = “D:\ PHP \php5\ext”


B. Open the OCI module and will; The extension = php_oci8. DLL,; Extension = PHp_oCI8_11g.DLL started; Remove to open the OCI module


After the module opens, restart IIS or Apache,
Check the output of your phpInfo () function to see if OCI8 is supported;

If not, proceed to the next step

2. Confirm whether oracle client is installed. If not, install Oracle client first. The client download address: link: http://pan.baidu.com/s/1kUUY1tP password: xq37.

At present, I am using oracle10g database and only have oracle10g client.

Installation tutorial: open ora10client.exe to start the installation, there is nothing special to set up, the default next step to know the installation is successful.


After successful installation, modify the HOST,PORT and SID parameters in the TNsnames.ora file under the Oracle folder


After modification, use the plsqldev.exe client to log in:


At this point, the client installation is complete. Please proceed to the next step

3. Write the oracle PATH to the computer environment variable PATH, and then restart the computer to make the PATH effective.

At this point, the basic solution to the problem, welcome to discuss.

If it has not been solved and there is a follow-up solution, please leave me a message, thank you.

A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): Headers and client

When I upgraded MySQL, the PHP linked database reported an error. After checking the data, I found that the MySQL version was changed, which was inconsistent with the previously compiled version, so the error was reported. The solution was to recompile mySQLND, my MySQL and PHP installed by YUM were very simple.

killall php-fpm
yum remove php70w-mysql
yum install php70w-mysqlnd

After installation, just restart PHP-FPM!

Record the pits you stepped on – NSS error – 5938 (PR_ END_ OF_ FILE_ ERROR), curl: (35) Encountered end of file

PHP passes curl POST data to HTTPS, the same code, with no problems on the first server. It has been unsuccessful on the second server.
Turn on debug Mode and you find the following log.
code:
————————————————————-
Try {
# 1. The init curl
$ch = curl_init ();

# 2. Set the option
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postFields);

if ($headerFields! = NULL){
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerFields);
}

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt ($ch, CURLOPT_SSLCERT, self: : CLIENT_CRT);
Curl_setopt ($ch, CURLOPT_SSLKEY, self: : CLIENT_KEY);
Curl_setopt ($ch, CURLOPT_VERBOSE, 1); #debug mode
Curl_setopt ($ch, CURLOPT_STDERR, fopen (“/TMP/curl_ssl. Log “, “w +”)); #debug mode, print log to:/TMP/curl_SSL.log

# 3.execute curl and get response
$result = curl_exec($ch);
Log::info(” info: HttpMethod:: http_post-get Result:”.$Result);

$rlt_array = json_decode($result, true);
$rsp_array = curl_getinfo ($ch);
Log: : info ($rsp_array);

# 4. Release the curl
curl_close ($ch);
} catch (\Exception $e) {
Log: : info ($e);
}
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — –

/tmp/curl_ssl.log:
————————————————————-

* About to connect() to 180.101.147.89 Port8743 (#1)
* Trying 180.101.147.89…
* Connected to 180.101.147.89(180.101.147.89) Port 8743 (#1)
* NSS error -5938(PR_END_OF_FILE_ERROR)
* Encountered end of file
* Closing connection 1
————————————————————-
Found an error calling HTTPS with the curl command:
————————————————————-

[root@localhost ~]# curl https://*.*.*.*
curl: (35) Encountered end of file
————————————————————-
Reason: You need to force the SSL version. Such as:
-2, –sslv2 Use sslv2 (SSL)
-3, Sslv3 Use sslv3 (SSL)
–ssl-allow-beast allow security arrest to improve interop (SSL)
–stderr FILE Where to redirect stderr.-means stdout
–tcp-nodelay Use the ctod TCP_NODELAY option
-t, –telnet-option OPT=VAL Set Telnet option
–tftp-blksize VALUE Set TFTP blksize option (must be > 512)
-z, –time-cond time Transfer based on a time condition
-1, –tlsv1 Use => TLSv1 (SSL)
– tlsv1.0 Use tlsv1.0 (SSL)
– tlsv1.1 Use tlsv1.1 (SSL)
– tlsv1.2 Use tlsv1.2 (SSL)

Add parameters — TLSV1 solves the problem:
[root@localhost conf.d]# curl –tlsv1 https://*.*.*.*
curl: (60) Peer’s certificate issuer hasbeen marked as not trusted by the user.
More details here: http://curl.haxx.se/docs/sslcerts.html


Reference: http://php.net/manual/en/function.curl-setopt.php
Select the SSL version you want:

CURLOPT_SSLVERSION One Of CURL_SSLVERSION_DEFAULT (0), curl_ssl1 (1), curl_sslv2 (2), curl_sslv3 (3), CURL_SSLVERSION_TLSv1_0 (4), CURL_SSLVERSION_TLSv1_1 or (5) CURL_SSLVERSION_TLSv1_2 (6).
Since tlSV1 is used here, the following sentence is added to code to solve the problem:
curl_setopt($ch, CURLOPT_SSLVERSION, 1);