Localhost MAMP does not get file contents from external webpage - php

I have installed MAMP version 5.5 and am using PHP 7.3.8.
I have switched on the allow_url_fopen = On in the php.ini file in the MAMP application
(MAMP/bin/php/php7.3.8/conf/php.ini)
I have tested to fetch the localhost like:
file_get_contents("http://localhost");
which works fine.
How ever as soon as I am trying to get external page the page is loading at snails pace and the it tells me it's timed out.
for example:
file_get_contents("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=".$origin."&destinations=".$destination."&key=".$api"")
I have the feeling it is something in the MAMP settings as this seems to work on a live server.
Any help welcome

Related

xdebug and MAMP horror show

i have been using MAMP PRO and xdebug for years (through Netbeans) and suddenly I am unable to debug. I have narrowed the issue down to the following. Whenever I append the parameter XDEBUG_SESSION_START=anyvalue to the localhost url the page freezes, and obviously, Netbeans just waits for a connection.
for example, the following url works fine:
localhost:8888/index.php
this url freezes:
localhost:8888/anypage.php?XDEBUG_SESSION_START=netbeans-xdebug
I have tried:
-closing all copies of Netbeans.
-restarting MAMP PRO.
-restarting the Mac.(Mavericks)
-deleting MAMP temp files in /Applications/MAMP/tmp/php
-creating a new MAMP host ..ex localhost1
nothing seems to fix the problem. There is nothing wrong with the php.ini file, or Netbeans config, or xdebug config. I am desperate.
To be clear, when i restart the computer, start MAMP PRO and nothing else (Netbeans is not running), then go here in ANY BROWSER---
localhost:8888/anypage.php?XDEBUG_SESSION_START=netbeans-xdebug
the page does not load and just waits.
other examples the following DOES load
localhost:8888/anypage.php?XDEBUG_SESSION_ST=netbeans-xdebug
the following DOES NOT load
localhost:8888/anypage.php?XDEBUG_SESSION_START=netb
what is blocking the connection when the get parameter "XDEBUG_SESSION_START" is added??? I am ready to give up.
Fixed this by changing one line in the php.ini file from:
xdebug.remote_host=localhost:8888
to:
xdebug.remote_host=127.0.0.1:8888
I have no idea why it worked with localhost for years, and all of a sudden did not. I suspect the installation of Xcode, but cannot prove or disprove.

Database can't connect on live server and blank page is displayed, all fine on Xampp

I am trying to setup a second instance of a website for testing purposes. I use the exact same files as the original version and all works fine when I test it on Xampp.
However, when I upload the files on the live server, something gets wrong. When the pages are loaded they appear as blank, there is no SQL error displayed, I tried this as well.
The code I use to connect to the DB is this one, if I remove it pages load correct, except that there is no DB connected. The DBHOST,DBUSER,DBPASS,DBNAME are all correct on live server as well:
$db = ADONewConnection('mysql');
$db->Connect(DBHOST,DBUSER,DBPASS,DBNAME) or die("Database not found! please install your application properly");
Also, all files in ADONewConnection library are fine, so it should be some setting on the live server that is different from Xampp and that I cannot think of.
I also tried this on another different hosting server and again no luck.
Any suggestions or ideas will be appreciated.

just PHP not working on Wamp-Server installation on Win7 64bit

When installing (and re-installing) Wampserver 2.5 I ran into this problem today:
Everyting set up fine and running "green" in wampServer, without any reported errors in PHP-/Apache-/mySQL
works (without any php-lines):
http://localhost/someHTMLfile.html
doesn't work (even withoput php-code inside):
http://localhost/someHTMLfile.php
The Problem: passing through files that would be processed by/to the php-parser/module result in a blank browser screen / "website not reachable"
As a 64bit Windows7 user you have to do some correction in the 2.5 wampServer config.
Although the server is "green", online and nothing is reported as malfunctioning,
the parsing stalls if the php module is fed.
As seen on http://forum.wampserver.com/read.php?2,123685 there is an incomplete parameter in the my.ini file.
This file is reachable and editable by the wampserverManager TrayIcon -> mySQL - > my.ini
You may want to change the line
[wampmysqld]
into
[wampmysqld64]
to get everything working just as it should.
Maybe it's just me stepping in some RTM-Trap.
Maybe it's not just me, though.

Getting Internal server errorHTTP 500 after trying to run wordpress with wampserver

I am new to PHP field, I have installed wamp server locally and tring to install wordpress with it. Wampserver is installed correctly and coming locally perfectly. Now I have downloaded the WordPress 3.9 version and trying to run it with the wampserver but I am getting http :500 error. I have edited the httpd.conf file and activated mod_dir.so but still I am getting the error .... anybody please help.

Eclipse PDT run as webpage refuses to work

I have Eclipse PDT version 1.3.0
PHP Version 5.3.8
Running on windows XP Pro
When I open the pages on localhost they work fine. But the 'Run as webpage' command on Eclipse doesn't work at all. It doesn't even show an error.
The only thing that happens when I start a file is that I get a dialog that says...
'Note that no files will be published to the server' and then gives the path to the server file.
When I press OK, nothing happens.
Help please
I'm new to Eclipse and had this problem too. I had to change my workspace path to point to my local server. I still received the "Note..." error, but since the files were already on the local server, I was able to view them without a 404 error.
Hope this helps.
Paul

Categories