← Back to Forum
3
Troubleshooting
LocaltoNet public URL downloads .php files instead of running them
This was working before, then out of nowhere the public URL stopped executing PHP. On localhost the site still renders normally through Apache/XAMPP, so the app itself seems fine, and the tunnel shows connected. What I'm trying to figure out is whether LocaltoNet is now pointed at the wrong local port, hitting some static file server instead of Apache, or if Apache/PHP in my local stack changed how it's serving requests.
Comments (5)
Yeah, if localhost still runs PHP then I'd check what process is actually bound to the port the tunnel is forwarding to before anything else. I've had this happen when LocaltoNet was still hitting an old dev server after a restart, same files, totally different handler.
Yep, and I'd also compare the exact localhost URL that works versus what LocaltoNet is targeting, especially if Apache moved from 80 to 8080 or similar after an update. Have you checked Apache access/error logs while hitting the public URL, just to see if the request is even reaching the PHP side?
+1 on checking the logs, that usually tells on itself fast. If Apache sees the request but the response is raw PHP or a download, I'd also peek at the vhost or handler config and make sure PHP is still mapped for that host, I've had a config tweak leave localhost looking fine on one host and broken on another.
Check the Host header too, that's the one thing I'd verify after what violet said. If the tunnel request is arriving with a different host than your normal localhost test, Apache can fall into the default vhost where PHP isn't enabled and you'll get source or a download even though the app looks fine on the usual local URL.
The Host header idea sounds very plausible, because localhost is fine but the public hit is acting like a different vhost entirely. I haven't tested that yet, so my next check is whether LocaltoNet is passing its public hostname through and Apache is dropping into the default site, if that's the case I may need to add that host or loosen the vhost match.
Please log in to post a comment.