Tag Archives: php

Class ‘PHPWord_Writer_Word2003‘ not found

Question:
Error in using PHPword to generate word:
Fatal error: Uncaught error: Class ‘PHPWord_Writer_Word2003’ not found in D:\ phpStudy_Pro \WWW\newword\ phpWord \ phpWord \ iofactory.php :110 Stack trace: #0 D:\ phpStudy_Pro \WWW\newword\ DEMO (132): PHPWord_IOFactory::createWriter(Object(PHPWord), ‘Word2003’) #1 {main} Thrown in D:\ phpStudy_Pro \WWW\newword\ PHPWord\ PHPWord\ PHPWord\ iofactory.php on line 110

Solutions:
The word version that should be used with you is concerned, I change Word2003 here 2007 can be used normally!

— — the END — —

Php7 compiles collect2: error: LD returned 1 exit status

Problem description
PHP7: PHP7: PHP7: PHP7: PHP7: PHP7: PHP7

/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol ‘ber_strdup’
/usr/bin/ld:note: ‘ber_strdup’ is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line
/lib64/liblber-2.4.so.2:could not read symbols: Invalid operation
collect2:error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

The solution
In the PHP source code directory vi Makefile open the file, find the EXTRA_LIBS line, line at the end of the add - llber save out of the again make

IntelliSense: unable to open source file ‘StdAfx. H’

-h /.cpp file: cannot open the source file “stdafx.h”, some methods found are not applicable, such as: set project properties ->; Configure properties ->; C/C++-> Precompiled header ->; Using (/Yu)/ creating (/Yc)/ not using precompiled headers does not work either way. Despite this error, the program was run successfully. The initialization and compilation runs seem to use different lookup paths, which is a problem when developed with a lower version of VS2005/VS2008 but opened with a higher version of VS2010. The solution is:
< wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> Project Properties -& gt; Configure properties -& gt; C/C++-& gt; General – & amp; gt; Additional include directory -& gt; < strong> $(ProjectDir)< /strong> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr>

PHP connection to MySQL database error: call to undefined function MySQL_ connect()

Problem description
I just started to learn PHP, and the system environment is Ubuntu+PHP7.0+Mysql5.7+Apache2.
running a database connection test sample error:

[client 127.0.0.1:37496] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/test.php:2\nStack trace:\n#0 {main}\n  thrown in /var/www/html/test.php on line 2

The sample code is:

<?PHP
    $conn=mysql_connect("localhost","root","root");
    if($conn){
        echo"ok";
    }else{
        echo"error";    
    }
?>

The solution
The mysql_connect() function has been deprecated since PHP5.0. In PHP 7.0 it has been deprecated and replaced with this function:

mysqli_connect();

Usage is:

$con=mysqli_connect("localhost","my_user","my_password","my_db");

The description of the official connection: http://php.net/manual/en/function.mysqli-connect.php
the correct test code:

<?PHP
    $conn=mysqli_connect("localhost","root","root");
    if($conn){
        echo"ok";
    }else{
        echo"error";    
    }
?>

conclusion

    in the Ubuntu + PHP7.0 + Mysql5.7 + Apache2 system under the environment of the wrong, because the mysql_connect () function has been deprecated, when following outdated tutorial learning may encounter this error. (note: if it is a Windows system, are more likely to be Apache2 not enable mysql, details on baidu) when running the above test code, interface without any reaction, the error is in the log to consult, log directory in the/var/log/Apache2/error log “.

Error report and solution of PHP module introduced by Apache

Preface:
Today, I will share with you the introduction of Apache PHP module error and solution
 
The incoming module file path has Spaces

 
Solution: The path is enclosed in double quotes

 
The requested operation has failed. The requested operation has failed.
 
Solutions:
1. View the version of HTTPD
  

 
2. Check the PHP version

 
3. Check the VC version of the machine

 
Then we can use this information to select the appropriate PHP package

In the above picture, I downloaded the Win32 vc14 x86 PHP package, only to download the corresponding version, can not report errors.

Phpcms development problems and Solutions

Problem: the foreground user cannot register or log in, and the backstage member management function also fails.
Customer demand: the database is only for internal use of the school and not open to the outside world. Therefore, it is necessary to set permissions so that users can browse and use the database after logging in. Users can add the database uniformly in the background.
Solution: first solve the background can not add operation user problem, and then solve the foreground can not login problem. Find the corresponding controller method, the template output via var_dump(), and pinpoint which function and which line failed. The front page reviews the elements, looking at network and console.
Error: Missing the \phpsso_server module file and the \ PHPCMS \templates\default\content\message.html file in the root directory.
Error reason analysis: the controller to add membership and login registration will refer to the function in PHPSSO to make judgment, because the file was deleted, so the missing method led to error judgment, and the operation failed.
from my copy the file on the server came in and found still fails, and in my project running on the server, there are doubts still lack of a file or the server configuration problem, the last row of fault detection is phpsso there are database configuration, as well as the domain name configuration, problem solving after the change.
at this time there was a problem again, log in at the front desk, it found that there will be a 500 error, then there is no any other error message, at this point the server error log (\ HwsApacheMaster \ Apache \ logs \ the error log) found errors for * * “Premature end of script headers (script head early end)” * *, received at this time a bit, so online on baidu, found that writing is a bit complicated to see different, said the reasons are not enough file permissions, CGI permissions: I searched how to configure and start CGI. I first changed the configuration on my server according to the operation (that is, changed the PHP configuration) and found that it still works normally, indicating that it is not a CGI problem. File permissions also changed to find or report error.
here is a little collapsed and no more errors, didn’t also found online to effective solutions.
later still use old way: by var_dump () and die, fault line by line. \ PHPCMS \libs\functions\global.func. PHP \ PHPCMS \libs\functions\global.func. PHP \ PHPCMS \libs\functions\global.func
function showMessage (MSG,url_forward = ‘goback’, ms=1250,dialog = ‘ ‘, $returnJS = ‘) {
(defined(‘ IN_ADMIN ‘)) {
i>de (admin::admin_tpl(‘ showMessage ‘, ‘admin’));
} else {
clude (template(‘ content ‘, ‘message’));
}
exit;
>
>
>
>
>
>
>
>
>
>
>
> 2. When there is no obvious error, the most important thing to solve the problem is patience, calm down analysis will always solve. The solution is simple, use var_dump and die background output, foreground view, line by line positioning;
3. The first step can solve most problems independently, and the second step can improve the time efficiency of solving problems.
Note: the
add background user controller:/PHPCMS/modules/member/templates/member_add TPL. PHP
analysis of related documents: /phpcms/languages/zh-cn/member.lang.php
/phpcms/modules/member/member.php
/phpcms/modules/member/classes/client.class.php
/phpcms/phpcms_server/phpcms/modules/phpsso/index.php
/phpcms/templates/default/member/mini.html
/phpcms/modules/member/index.php

PHP – PHP Error[2]: Error while sending QUERY packet. PID=*

In the company project today, such an error occurred when yiIC was used to run the database write operation, as shown in the figure below:

Project Scenario:
A big insert SQL and format for the insert INTO the TABLE VALUES (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’)…
Code snippet:

It turns out that MySQL’s max_allowed_packet is too small.

The default max_allowed_packet is only 16M, which will occur if the SQL exceeds the set size.
Solutions:
1) Modify the MySQL configuration file
Edit my.cnf (My.ini under Windows) in the [mySQld] section or the server configuration section of mysql
Max_allowed_packet = 50M (or max_allowed_packet = 50*1024*1024)
2) Command line modification
set global max_allowed_packet = 50*1024*1024

cURL error 35:error:140770FC:SSL routines:SSL_23_GET_SERVER_HELLO:unknown protocol

A problem occurred during the SSL/TLS handshake. You do need error buffering and reading messages there, because it hints at the problem. This can be a certificate (file format, path, permission), password, and so on.

Bug tip :cURL Error 35: Error :140770FC:SSL :SSL_23_GET_SERVER_HELLO: Unknown Protocol

Solutions:
1. Modify SSL version

Curl_setopt ($ch, CURLOPT_SSLVERSION, 3); // Set SSL version,1-3 switch

Curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); //
Do not check certificates

If this doesn’t work, see below

2. Modify the file permissions to 777
If this doesn’t work, see below
3. Remove the requested https://
Example: change https://www.360kan.com to www.360kan.com

cURL error 60: SSL certificate problem…

PHP reports this error in curl:

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Query 60 errors according to the address indicated after the error report:

CURLE_SSL_CACERT (60)
Peer certificate cannot be authenticated with known CA certificates.

Unable to obtain local issuer certificate
Solution: (http://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate) search on the net
Error regarding “SSL Certificate Problem: Unable to obtain local issuer certificate”. Obviously, this applies to the system that sends CURL requests (and the server that doesn’t receive them)
1) from https://curl.haxx.se/ca/cacert.pem. Download the latest cacert pem
2) Add the following line to php.ini (if this is Shared hosting and you do not have access to php.ini then you can add to.user.ini in public_html)
curl.cainfo=/path/to/downloaded/cacert.pem
3) by default, the FastCGI process will analytical new file every 300 seconds (if needed, you can add several files to change frequency, such as suggested here https://ss88.uk/blog/fast-cgi-and-user-ini – files – the – new – htaccess file /)

Unsupported operation types unsupported operation data types

Fatal error: Unsupported operand types
It means:
Fatal error: Unsupported operation data type
The reason is that data that does not conform to the data type is passed to some function. This is especially true if you pass an array to a function that takes a number as an argument.
 
That’s what I just ran into.
 
Put an array ([0] = & gt; 123456), I was going to pass 123456.