I'm facing a strange problem with PHP CLI.
PHP runs perfectly fine when accessing files through the web browser. I can run CURL scripts, connect to databases and perform any kind of connection available on PHP, either locally or to external addresses.
But if I run the same script on CLI, I always get the following error:
Warning Error: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Host desconocido. in ...
This is a global problem, and it's not related to my scripts, because if I run, for example, the installation for composer, I get the same error while trying to install.
I tried reinstalling WAMP, going back to the default PHP.ini and enabling IPv6. I compared the ini values on CLI and on normal mode (through ini_get_all()) and there were no differences, besides the normal ones.
I'm running WAMP latest version, on Windows 8 x64.
Related
I'm trying to setup a websocket server in a development pc. I've been trying a few examples from github and all of them with the same result. Error 500 after a few minutes.
I already have enabled the websocket protocol on Windows optional resources, the extension is included in the php.ini file. I tried running the scripts on CMD and nothing seems to work. I also tried inserting a few breakpoints using xdebug and the script is being reached, it just keep refusing to perform the handshake. Is there anything that I may be missing?
The PC is running Windows 10, with PHP 5.6.3.
I had installed MAMP on my windows 10 machine. I had then configured the MySQL thru the phpMyAdmin and had installed the WordPress. Later due to certain issues, I had to un-install and re-install the MAMP again. This time Apache started running and I could reach localhost/MAMP/, but when I click on phpMyAdmin, I get the message:
"mysqli_real_connect(): (HY000/2002) No connection could be made
because the target machine actively refused it
.....You should check the host, user name and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server". I ran the command> MySQL -u root -p status. It asked for a password. On giving the password, I got the following: Error 2003 (HY000) Can't connect to MySQL server on localhost (10061).
Please help with a workaround.
The error was resolved thru re-installation and taking care to disable the installation of MAMP Pro which happens by default.
I usually see the "actively refused" error when I try to connect to a port that the MySQL server is not actually running on. That said, I don't know why this would happen out of the blue. Maybe you should be using WAMP instead of MAMP?
You could probably troubleshoot this issue remotely with third party tools that have debug logging (MySQLShell through its Application Log)
Check all your Microsoft Redistribute Packages are installed correctly. If the problem exist then use the XAMPP or WAMP for the Windows because MAMP is generally used for the MAC OS.
between yesterday and today something happened that prevents processes running under Apache accessing an MSSQL server that is essential for functioning of the site.
This is what I find in the Apache error logs for PHP scripts:
PHP Warning: mssql_connect(): Unable to connect to server
Flask/SQLAlchemy applications are a bit more informative:
OperationalError: (OperationalError) (20009, 'DB-Lib error message 20009,
severity 9:\\nUnable to connect: Adaptive Server is unavailable or does
not exist (####:1234)\\nNet-Lib error during Permission
denied(13)\\n') None None
When I start the same WSGI app in test mode from the console on the same machine that Apache is running on, everything works. To summarize:
Both WSGI and PHP fail to connect to an MSSQL server literally overnight if run under Apache
When run w/o Apache, the WSGI scripts work fine (can't tell about PHP because that's not my domain)
Nothing was changed on the server that runs the web applications (can't say about the MSSQL server)
I need a clue quick. This stuff is running in a company intranet and people are getting impatient. I have control only over the RHEL server running Apache, not the MSSQL server.
The troubleshooting tips using tsql on the freetds page all work fine.
My /etc/freetds.conf is just out of the box and essentially empty (everything commented out).
Turns out it had nothing to do with Apache et al. This was an SELinux permission issue which started after the VM was rebooted during the night, probably initiated by a sysop in India. Apparently there was an updated security policy for apache. Found the issue in /var/log/messages, which thankfully even included instructions on how to fix it.
I'm running Apache 2.2 and MySQL Workbench, and using PHP to access the database.
The problem is, when I try to open the database I've made, MySQL Workbench can't seem to connect to the localhost at port 80, and the program stops responding.
How can I fix this?
Update: After some time of the program simply not responding, it gave me this error message:
"Unhandled exception: Lost connection to MySQL server at 'waiting for initial communication packet', system error 10060 (code 2013)"
A wamp installation has a lot of issues. Instead, you can run a Virtual Machine with ubuntu and run there LAMP. it is way more reliable than running wamp that is not supposed to be "equal" in terms of your production environment - that for sure is linux based OS. Also, keep in mind that programs such skype blocks the port 80 and 443. Search what programs are using the port for mysql... that's why I don't develop AMP apps under windows, but under linux.
I'm running 5.2.14 with IIS on Windows 7. Used the Windows Platform Installer.
When I write a script that uses cURL or file_get_contents() and run it via the commandline, everything works great.
If I use the same code in a web page, running in IIS, the request always fails. cURL returns a response code of 0. file-get_contents comes back with "Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known". I even tried putting the code in a separate script and running it via exec() to pipe the output back to my web script. But the script, which works fine from the CLI, fails when called by a PHP script being executed by IIS.
php.exe -i returns no errors. phpinfo() run via IIS in a web page shows the same active/activated cURL as in php.exe -i. My libeay.dll and ssleay.dll libraries are all over my path.
There doesn't seem to be a problem with cURL itself. My best guess is that this is a firewall thing or a permissions thing, where IIS runs PHP as a guest user who is blocked from network access, but when I run it from the commandline, I'm not blocked.
I don't know enough about configuring IIS or the firewall or security policies to figure out where to change things and I don't want to accidentally open up a big hacker tunnel into my system by just randomly lowering security until something clicks. Please help.
"Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known".
That's your clue, No such host is known, try a raw IP address see if that works, if so then it's because PHP can't see hosts basically IIS isn't passing that info in perhaps.