I have web server in my local network (Apache/2.4.10 + PHP 5.6.36 on Raspbian GNU/Linux 8 (jessie) 4.9.35-v7+ on Raspberry Pi) with hostname webserver. Then I'm also using a local webserver (localhost) on my workstation (Win 10 Home 64bit + Apache/2.4.25 + PHP 7.1.4).
After update to Win 10 "April update" (1803) I have this issue: when a PHP script on my localhost (i.e. workstation) tries read some file from webserver via file_get_contents()
$content=file_get_contents("http://webserver/file.php");
I get this error:
php_network_getaddresses: getaddrinfo failed: The requested name is valid, but no data of the requested type was found.
When I change hostname to IP address (http://192.168.1.100/file.php) then it works. Also there is no problem when I put http://webserver/file.php directly in my broswer (on workstation). The problem is only when a script from localhost (workstation) is trying to reach address on webserver with hostname in address.
Before Win 10 April update everything worked fine, so where can be a problem? I have installed all Windows updates but it didn't help...
Check your HOSTS file in C:\windows\system32\drivers\etc\HOSTS
Some Windows updates replace this file with a default, which would explain why you can no longer access the server as there will be no reference to it in the HOSTS file.
Related
I've installed WAMP Server on Windows 10 and it was working fine. But when I try to load localhost today it gives me refused to connect error. I've read some questions on Stack Overflow and tried their answers but no luck.
Re-installed wamp (also tried xampp. non of these work)
IIS is off
Web Development.. thing in services is not running.
Tried netstat -aon and port 80 PID is same as wampapache64 process.
changed listening port to 81 in httpd.conf in wamp => apache =>
Cleared browser cache
Wamp icon is green
Can't connect using 127.0.0.1
Nothing works.
Screenshots:
I will assume the wamp icon in the system tray is green. I think you should start tracing the root cause from the apache error/access log.
Try change the http port to 8080 and access localhost:8080. left click the wamp icon in the taskbar, go to apache > httpd.conf and edit this file: change "listen to port .. 80" to 8080.
Try the hosts file with only the initial records and test.
127.0.0.1 localhost
::1 localhost
If you are facing the error from the apache errors log file
(OS 10038)An operation was attempted on something that is not a socket. : AH00332: winnt_accept: getsockname error on listening socket, is IPv6 available?
then do the following:
* Run 'command prompt' as administrator and run the command netsh winsock reset . and restart the PC.
Skype default port is 80 and this might be having a conflict .. try to change it from Skype options.
Finally make sure the antivirus or any firewall you are having is not blocking your application requests.
firstly, uninstall wampp as well as xampp server from your PC. Also delete the wampp/xampp folders in C drive.
then install wampserver 2.0i from the link below-
wampserver 2.0i
after installation, start wamppserver and try to open localhost in chrome browser.
if localhost doesnt work, then try localhost:80
hope it helps!!
Problem
I've recently found out that PHP has a built-in webserver which can be used for development purposes. Starting the server with the address "127.0.0.1" and the port "8080" works without any problems and my requests are handled properly. However, if I dare to use the address "localhost" with the same port, the webserver doesn't handle any requests.
Specs
Windows 10 64-Bit
Php 64-Bit Thread-Safe installed
MongoDB installed (Not running)
IIS Server installed and running
MariaDB installed (Not running)
Name resolution for localhost is handled by your DNS server which is likely resolving it to the IPv6 address ::1.
If you run:
php -S 127.0.0.1:8080
The webserver is running on the IPv4 address but localhost resolves to the IPv6 address.
So you can either use 127.0.0.1:8080 in the browser address bar.
Or force the address by un-commenting the following line from C:\Windows\System32\drivers\etc\hosts:
# 127.0.0.1 localhost
Or bind the webserver to the IPv6 address (this is what I do):
php -S localhost:8080
I have set up an IIS 7 to a Windows Server machine. The idea is to access a working php site through a network computer and for the php to be able to be compiled.
Steps i did:
Downloaded PHP 5.6.31 (i have to use the specific version)
Unzip php files in c:\php directory.
Rename php-ini-production to php.ini
Copy the same file to c:\Windows
Create a website in IIS.
Added 2 bindings to website with following data:
-Type: http, host name: test.local, port: 81, ip address: *
-Type; http, host name: blank, port: 81, ip address: the ip address of the
Workstation hosting the IIS
Added at IIS site and new website at Handler mappings the following:
request path: *.php, Module: FastCgiModule, Executable: C:\php\php-cgi.exe
and clicked request permissions and on Mapping tab i checked Invoke handler only if request is mapped to and i selected File or folder
Added at IIS and new website at MIME types the following:
file name extension: .php, MIME type: application/x-httpd-php
At IIS at ISAPI and CGI restrictions i added php-cgi.exe path and clicked Allow extension path to execute.
I installed Visual C++ Redistributable for Visual Studio 2012 Update 4
In php.ini file (the one i renamed above), i uncommended and set values for the below:
-fastcgi.impersonate = 1
-cgi.fix_pathinfo =
-cgi.force_redirect = 0
-extension_dir = 'ext'
From control panel from System->Properties->Advanced system settings->Environmental variables, at the end i added ;c:\php
Restarted iis
Now when on server i run server's ip for example: 10.0.0.1:81/index.php (where index.php is a file inside my website) i get a http Error 500, C:\php\php-cgi.exe - The FastCGI process exited unexpectedly with error code: 0xc0000135
When i run the same from network computer i get just a 500-Internal server error.
When at network computer i try to access the index.php file as a file (network location) i see just the php code and not the compilation.
Any ideas?Thank you in advance
I can not connect to LDAPS server (3rd party) from PHP (PHP 5.5.4, Apache 2.4, Windows 7 64bit). When I'm trying ldap_bind() function with userdn and password, I receive - Unable to bind to server: Can't contact LDAP server.
I have self-signed certificate from the LDAPS server, but I don't know where to put the PEM file (Base64) or something like conf.file (I have read many answers for this, but nothing works for me - e.g. c:\openldap\sysconf\ldap.conf, TLS_REQCERT never etc.).
Development folder is D:\WebDev where inside is \www folder with projects and \binaries folder with \Apache folder and \PHP folder. PHP is an module for Apache and Apache is started by httpd.exe --standalone --console.
Openssl s_client -connect xxxx -CAfile xxxx to LDAPS server works good, return code is 0. Without -CAfile I fet code 19 (self-signed certificate in certificate chain).
LDAP without SSL works fine for me, I've tried some free online LDAP test server.
The problem is solved. Notice: there is no Openldap installation on the machine.
Solution is to set Windows system variable LDAPCONF, value is e.g. c:\users\user\.ldaprc and in the file .ldaprc set the path to certificate e.g. TLS_CACERT c:\users\user\.ssh\ldap-ca.pem or TLS_REQCERT never, both is working.
Then connection script from console or via Apache from browser is running OK.
The default search path for conf is c:\users\user\, but for browser app running via Apache must be set the system variable LDAPCONF.
I hope this help !
I updated my version of PHP (by installing a newer version of XAMPP), but I'm having trouble getting the server to use the necessary port with PHP so that it will run the correct version of PHP.
Due to the well-documented conflicts for machines running Windows, I changed the Apache ports to 81 (from 80) in the httpd.conf file for: Listen and ServerName localhost.
It appears to be running correctly. Both Apache and MySQL are running in the XAMPP Control Panel
Apache - Port: 81, 443
MySQL - Port: 3306
PHP ini was set to 3306, and I therefore left it as is.
http://localhost:81 shows that I'm running the correct version of PHP (Version 5.6.3)., however when I try opening a file at localhost:81 I receive the following error message:
Object not found! The requested URL was not found on this server. If
you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
The only way it's allowing me to access the files is at http://localhost:2556, which is running an old version of PHP.
Any suggestions how I can get my PHP documents to access the proper port and version of PHP?