Tag Archives: php

Configure: error: Cannot find libz error appears when brew installs php70

This article from the PHP ecshop secondary development blog, please be sure to keep this from http://phpecshop.blog.51cto.com/6296699/1883448

According to the tutorial “New Installation of Mac OS Sierra (10.12) and using HomeBrew to install ZSH + MNMP (Mac + Nginx + Mysql + Php) Development environment”, there was an error in using BREW to install PHP70 on the Mac.

brew install php70 --with-debug --with-gmp --with-homebrew-curl --with-homebrew-libressl --with-homebrew-libxml2 --with-homebrew-libxslt --with-imap --with-libmysql --with-mysql

Error message:

configure: error: Cannot find libz

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/josegonzalez/homebrew-php/issues

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': Validation Failed (GitHub::Error)
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:233:in `issues_matching'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:266:in `issues_for_formula'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:325:in `fetch_issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:321:in `issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:383:in `dump'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'

Solutions:


$ xcode-select --install


$ brew install php70 --with-debug --with-gmp --with-homebrew-curl --with-homebrew-libressl --with-homebrew-libxml2 --with-homebrew-libxslt --with-imap --with-libmysql --with-mysql

Fixed

Reference link:
http://stackoverflow.com/questions/39442552/5-boxen-errors-when-running-boxen-our-boxen

docker apache php-fpm AH01071: Got error ‘Primary script unknown\n’

Here’s the background:
In Docker, a container Alpine runs Apache (2.4.33, MPm_Event),
The other container runs PHP-FPM (7.2.8), so Apache and PHP-FPM are in remote linkage mode.

Many Settings refer to a large number of night data debugging, and all errors are reported:
AH01071: Got error ‘Primary script unknown\n’

After verification of configuration one by one, it is inconceivable that the problem is found. Let’s first give the correct configuration:
1. HTTPD. Conf
* Clear out lines like AddType Application/x-httpd-PHP PHP php7, which are not used by PHP-FPM.
* Similar paragraphs like the following are not required in httpd.conf:
< FilesMatch \.php$> SetHandler “proxy:fcgi://php-fpm:9000” < /FilesMatch>

2. The correct configuration requires only one line:
ProxyPassMatch ^/(.*\.php(/.*)?) $ fcgi://php-fpm:9000/v/php-fpm/www/$1
Put this line in your vhost.conf < VirtualHost> In the water.

Pay special attention!
1. My DocumentRoot path and the last path of ProxyPassMatch do not match!
(DocumentRoot/V/Apache/WWW) Apache startup needs to actually detect the existence of DocumentRoot path memory. That is, my data is in the Apache container, and after fCGI :// pushes the data to the PHP-FPM container, the PHP-FPM container needs to read this/V/Apache/WWW path, if it does not read, it will report an error AH01071. The foreground page says “File Not Find!”

Therefore, the core idea of the solution is to make the two containers have a common accessible file address. This is not redundant, with mount and other ways to solve.

2. Note the phP-FPM listen Settings
\php-fpm.d\www.conf
My listen = 172.0.0.3:9000
Here you cannot write 127.0.0.1, two containers in a virtual Intranet segment, and you can also write the Intranet address of the segment.

PHP Error Object of class mysqli could not be converted to string in

Write a PHP encountered an error: the Object of the class mysqli could not be converted to a string
An object of class mysqli_result cannot be converted to a string
Check the code:

    function query($sql){
        echo $sql;
        $query = mysqli_query(self::$con,$sql)or die(mysqli_error(self::$con));
    
        return $query;
    }

Mysqli_result is returned by mysqli_query, so the error should be on the return value.

You cannot directly output an object as a string in PHP5 above.
So just change the type of the return value.

    function query($sql){
        echo $sql;
        $query = mysqli_query(self::$con,$sql)or die(mysqli_error(self::$con));
        return  mysqli_fetch_array($query);
        //return $query;
    }

Returns as an array with the mysqli_fetch_array() function.

 

‘break’ not in the ‘loop’ or ‘switch’ context Error (Fixed)

Fatal error: ‘break’ not in the ‘loop’ or ‘switch’ context in
. /assets/Classes/PHPExcel/Calculation/Functions.php

‘break’ not in the loop ‘or’ switch ‘context

wrong position FILE:/private/var/WWW/backend/ThinkPHP/Library/Org/Util/PHPExcel/Calculation/Functions provides PHP LINE: 576
A search on the Internet, there are indeed a lot of people also asked:
Just delete ‘break’ on line 576!
Some people on the Internet say that the higher version of PHP7.0 is only available because:
As break is after return statement, so it giving fatal error.
Because break reported a syntax error after return! That’s not true!
Others say the bug has been fixed in 1.8.1! I used 1.7.9, you must use the latest version in the future!
— —
copyright notice: this article is the original article of CSDN blogger “deep drifter”, and follows CC 4.0 by-sa copyright agreement. Please attach the link of original source and this statement to reprint.

FreeRDP installation configuration (error message: SSL_read: Failure in SSL library (protocol error?))

Latest post: Virson’s Blog
Using the xfreerdp [ServeripAddress] command, the connection to XP/Windows 2003 is normal, but the connection to Win7/2008 is always wrong:
; ——————————————————————————–
Root @pg-vm:/etc/ld.so.conf.d# xfreerdp 192.168.7.195-u empt-p 123456
connected to 192.168.7.195:3389
Password:
SSL_read: Failure in SSL library (protocol error?)
SSL_read: error:14094419:SSL :SSL3_READ_BYTES:tlsv1 alert access denied
credssp_recv() error: -1
Authentication failure, check credentials.
If credentials are valid, the NTLMSSP I Either mplementation may be to blame.
; — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
how to solve?
A: When freerDP connects to Win7/2008, you need to specify the user name in the command line. Note the parameters of FreerDP
The above error is due to the wrong order. Please use the following command line to connect:
Xfreerdp-u Empty-P 123456 192.168.7.195
————————–
References:
[1] [Freerdp-devel] Authentication Failure with Win2008 with Current Security Updates (worked some time ago)
http://sourceforge.net/mailarchive/forum.php?Thread_name = 4 fa84187. 40 8060009% wp. Pl& forum_name=freerdp-devel

Reproduced in: https://www.cnblogs.com/mawanglin2008/p/3493108.html

A yellow warning appears on the pagecontroller page in PHP! ! ! !

* *
On the problem of error reporting in Pagecontroller in PHP
* *
looks just like me a lot of people started just dumb to find why the error, but this is not a mistake, page controller is running, just no display in the current page, so there will be prompted to alert, so you need to add url address behind you to display the page address (the name of the PHP file)
if

and error before the url is:


did not report an error when it was opened for the first time, but when it was opened again the next day, I do not know how to report an error. Moreover, it was an error in the source code.
this error probably speak pathinfo is not open, online a lot of code is said to modify the PHP ini file configuration inside, but I was configured also not the last line error, finally it is helpless, can only reinstall warmserver, the import pagecontroller, but still no use, it’s helpless, had to once again to look for ways to solve the problem, and finally found that there is no creation page, really sick…
the first step is to locate the php.ini file,e… I didn’t know where to start, because there were so many directories that I couldn’t find them, and then I started searching the Internet for where the files were. So there are still a lot of detours in the beginning of a language, and these detours are also another kind of learning of the language.

composer Failed to decode response: zlib_decode(): data error

Composer error problem

Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info

The cause of this error is usually the network.
The solution
Composer page provides a degraded mode solution. If we have ipv6 on we need to uncheck ipv6.

php_network_getaddresses: getaddrinfo failed (How to Fix)

When calling an external service request, PHP addresses: getaddrinfo failed: Name or Servicenot Known with an error:The reason:
PHP host cannot connect to DNS server

Analysis: such as the services you access request is www.leyangjuntestxxxx.com

You can first ping or Telnet the domain name to see if it is accessible, if it is responsive

Failure to ping indicates that your service is now connected to a problematic DNS server

General solutions:

One: It is necessary to check whether the remote host of the request is in /etc/hosts of the native host

Two: the need to check the rules of the firewall, is not intercepted by the response

Three: You can manually bind host in the /etc/hosts file

php Error: mail() Failed to connect to mailserver at “localhost” port 25

When there is a:

warning: mail() [
function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in E:\TOOL\Apache\htdocs\rzchina_beta\club\includes\mail.inc on line 193.

Unable to send e-mail. Please contact the site administrator if the problem persists.

or appear:

mail(): SMTP server response: 550 5.7.1 incapable to relay for error.

solution:

install IIS built-in SMTP, right click on the SMTP virtual server, and set the following Settings in the popup properties window:

click the access TAB, then click relay, click add out of the popup window, then select the single computer, add IP address to 127.0.0.1. And then make sure you go all the way back. SMTP Server Response: 550 5.7.1 incapable to relay for… The error)

test it out:

< ?php

mail(“[email protected]”,” test “,” test if received “);

?>

openservice ERROR_ACCESS_DENIED

Today, my colleague wrote a program to get the Window service with Sigar, and found that several services could not get out anyway.
I looked at the code and got it using OpenService, so I wrote a Demo using VC, but I still couldn’t get it.
But the error code is this 5, check MSDN is access problem.
 
Take a look at the permission bits obtained by Sigar, compare MSDN, Sigar USES ALL_ACCESS, but in Windows Scardspace, how to report an error.
http://www.cpp-home.com/forum/viewtopic.php?f=1& t=16325
http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/8c28faac-9056-4e72-9839-1f475079adc4
http://msdn.microsoft.com/en-us/library/windows/desktop/bb540474(v=vs.85).aspx
http://bbs.pediy.com/showthread.php?t=115649
 
After searching a few articles, the question was not completely solved, but fortunately we just want to get the status, not start and stop service, so we changed the source code, add a read permission bit (see MSDN), so
Even the bypass solves the problem.  
 

Online problem solving analysis

Yesterday, the company’s server upgraded the hardware, only upgraded CPU and memory, and then after the restart, things running online will not run, check, all ports and services are open, firewall those, the results found that the ports and services, firewall allowed ports are open
Still can not run, to 10 o ‘clock in the evening, suddenly a friend said, or turn off the firewall to try, the result is good, forgot to check the firewall information
The only port we’ve used so far is

cat: /etc/sysconfig/iptables: Permission denied
[dev@chttl-8a6e210a8d27536a ~]$ sudo cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

And that’s all,
The results after checking the firewall information found that TM also used SMB this I really do not understand

ack)
Jul 17 09:08:32 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[28014]: [2015/07/17 09:21:32.803089,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[28014]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:21:32.803424,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[31824]: [2015/07/17 09:34:33.385856,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[31824]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:34:33.386165,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[3272]: [2015/07/17 09:47:34.017469,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[3272]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:47:34.017824,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[7256]: [2015/07/17 10:00:34.651162,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[7256]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:00:34.651720,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[11582]: [2015/07/17 10:13:35.362361,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[11582]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:13:35.362682,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[15564]: [2015/07/17 10:26:35.823554,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[15564]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:26:35.823862,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[19370]: [2015/07/17 10:39:36.439927,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[19370]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:39:36.440280,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL

I still don’t understand what this 631 port is for
I checked. Yes
Samba server is Unable to connect to CUPS Server localhost:631 — denied the connection
So this is a real problem. I didn’t use Samba in the first place, but then I thought, well, maybe it’s the Yamaxun server, so it’s a problem
To sum up, I still want to look at the log. I looked at the Apache log and the PHP log, but I forgot to look at the firewall log. I thought I wanted to open the ports, the results, or wrong, never think that to actually do it
 

move_uploaded_file() failed to open stream: Permission denied


Warning: move_uploaded_file(…) : failed to open stream: Permission denied in …..
Warning: move_uploaded_file(): Unable to move
This problem occurs because the PHP program does not have permission to create files in the specified directory

The first solution:
chmod -r 755
Adjusts the target path permissions
The second solution
Find the owner of the Apache process, and then change the owner of the target path folder to be the owner of the Apache process
chown -R [owner] [directory]