Linux PHP MySQL - php

Hi I am now into something that keeps confusing me. The problem i have is that i transfer my Domain DNS into a Linux Hosting because of massive attacks, Before i was running my website into a xampp Apache for Windows. i put a Anti Ddos Software but it can't really mitigate the server attack everyday. until yesterday that we discovered that we have a 100 Million Attacks filtered by the Main Firewall. and our firewall gives up.
to make the story short i transfer my Website files into a Linux Apache Server to another hosting... but the MYSQL server stays on my Windows Server. i also change the port of MySQL server into something not related to the default 3306.. i made it 4444. the reason why i don't transfer MySQL is because this MySQL is connected into My Private Hosting of a Game. now all i want is to access the MySQL from Linux Hosting using PHP. Here is My Current Code for Connection
I paste into text file in my website here is the Link
Note: I allow all Ports that is Necessary from Remote Connection, And i Close the Port 80 to Prevent Server attack..
Thanks in advance for the help...

Related

xampp apache server up and running, yet bad request

I got some trouble with my xampp on Win 10, as so many have had before me...
It's the same old port problem with skype and IIS.
I used to quit skype and stop the world wide web publishing service, but am sick of having to go through the whole ordial every time I start xampp.
so yesterday I changed the ports for my apache server and ecerything worked fine.
started up today and boom...localhost couldn't find my pages.
So I checked for port problems in xampp...there were none! apache was up and running(as were mysql server and filezilla). no error messages, nothing.
I resetted the ports to 80 and 443. killed of skype and the iis and everything worked fine again. Now whenever I change the ports, it will not run.
I did everything according to here:
How to change XAMPP apache server port?
(I changed the ports in httpd.conf, httpd-ssl.conf and in service and port settings )
I just don't get it. why it won't run with changed ports(and yes I checked the ports for being empty).
atm I have changed the port 80 -> 8024
and port 443 -> 1337 (no matter what I change this port to it always throws bad request)
8024 works fine. I can get to the dashboard via localhost:8024
but localhost:1337 gives me a bad request.
any suggestions, or similar encounters?
For now will have to continue using standart ports and kill of the 2 processes, but I really wanna skip that in the future.
I used port 80->8024
and port 443->448 yesterday and it worked fine...really weird...
Ok so that means your system has Microsoft IIS installed or one of the other bits of MS technology that reports that signature, they are doing that on later versions of Windows for some reason.
If you are not intending to use it you can uninstall it, it is not an integral part of windows so its being uninstalled wont effect normal operations of windows, and if you need to install it again later, it comes as part of the standard OS so you wont need to do anything perticularly clever.
So go to Start -> Control Panel -> Programs and Features
Click the 'Turn windows features on and off' link in the left hand menu.
Wait for the list to load and then find 'Internet Information Services'
Un check the check boxes for the following items ( you may not see all of them ), and there may be others I done know about. You may have all of these or just some of these.
IIS
Web Deploy 2.0 (Web Deployment Agent Service)
MS Sql Server Reporting service.
BranchCache ( Windows 8.1 )
SQL Server VSS Writer
List of possible service names not sure how up to date this is.
Tutorial on how to find what ports are in use on your system and what app is using them
Windows will then have a think for a while and then remove those applications, you will probably be asked to reboot to complete the uninstalls.
Reboot anyway when the uninstalls are complete.
Then try XAMPP again

MySQL Abruptly Refusing Remote Connections

UPDATE
So I completely disabled my server's firewall and it appears to be the culprit. I had tried to disable certain rules before but disabling the whole thing worked. Very frustrating, but problem solved I guess... I think the key indicator that it was the firewall was because it happened at exactly midnight when my server likes to apply updates and such.
This is pretty strange to me, I have a server downstairs that hosts my websites and MySQL servers and it has been running for years without many issues. I have 2 routers bridged together behind my modem and my server is behind one of them. All other devices connect via WiFi. All of the proper ports are open on the router and I have users configured in MySQL that haven't changed and have been working fine this whole time.
So last night I was working on a project and I decided to sync everything with a backup on my SkyDrive. I have a scheduled backup for MySQL that runs at midnight (daily) and it just turned over to midnight so I decided to open my network and watch the file get populated before I sent a copy to my SkyDrive. After the backup was complete (which it did successfully), I was going to continue to work on my program but all of a sudden I can no longer connect via my local network to the MySQL server. I'm using PHP and my connection string never changed and all other MySQL admin tools don't connect. The live site works fine, so MySQL was definitely running and working but no remote connections were being accepted. Why is this happening all of a sudden?
Things I've tried :
I did notice that my logs were packed full of BINLOG errors so I turned off the binlog since I recently turned it on (a couple weeks ago).
Restarting MySQL
Turning off Windows Server 2008 firewall (temporarily)
Connecting from a different device (mobile phone, tablet), no luck
Temporarily allowing port 3306 on my router
Checked server logs for intrusion attempts, none present...
Setup :
PHP 5.4 on local machine and server
Windows Server 2008 Enterprise (on server...)
MySQL Version 5.5.25a
Does anyone have any clue as to what's going on here? I'm going to reboot my server when the load is low and see if this helps any, I will update this once it comes back online.
So I completely disabled my server's firewall and it appears to be the culprit. I had tried to disable certain rules before but disabling the whole thing worked. Very frustrating, but problem solved I guess... I think the key indicator that it was the firewall was because it happened at exactly midnight when my server likes to apply updates and such.

PHP on Linux randomly fails to connect to Microsoft SQL Server 2005

(Not a Linux guru!) At work we have for the past month had a serious issue that we haven't been able to solve. From a server running Ubuntu-Linux we are using PHP to connect to a server running Microsoft SQL Server 2005. This has been working without problems for a long time. At the start of February 2013 we moved the SQL Server machine into the same core network as the Linux-machine, which involved changing IP-address on the Windows-server running SQL Server 2005.
After this operation we've had issues connecting to the SQL Server from this particular Linux-machine. Maybe one out of 1000 connections fails with the following error message:
PHP Warning: mssql_connect(): Unable to connect to server
I'm not aware of any other changes to either of these two servers. We've tried to look at 'everything'.
FreeTDS
php.ini adjustments
IP-address in SQL Server Configuration Manager
Unlimited number of concurrent connections in SQL Server
Network and firewall issues (No packet loss during 24 hours)
Any suggestions to how we can pursue error searching for this problem? Any more info anyone would like to know about this setup? It's kinda serious for us since many of our cronjobs fail to execute normally due to this random connection problem.
Rgds,
Sven David, Norway
Very difficult to diagnose from an external perspective, however, it feels like a networking issue rather than php/sql config. Presumably, because it's intermittent, it's not mssql functions/extension. Very little is truly random!
Perhaps approach this by writing a script that monitors the servers (both hosts) vital stats - like a heartbeat: IPs, DNS, DHCP?, requests etc and setting it to record anomalies/alert you when any element changes on either host or connect requests fail...
Probably worth posting on other SE sites too - not just Stackoverflow.

ADO and msqli connections very slow

I am experiencing a very slow ADO and mysqli connection for my production web server. The current software setup is windows 2008 server R2 Standard Edition SP1, Apache 2.4, PHP 5.3.10, MySql 5.5.24, Pear 1.94, Zend Engine version 2.30.
I've profiled the code using XDEBUG and it shows the initial connections taking around 1200ms each (regardless of page being visited), whereas on my local development machine and another test server the connections only takes around 8ms. The code for the website is all in sync through SVN except for the php, pear, mysql, and apache ini and conf files. I've done diffs on these to check for differences and there aren't any. The DB contents are a complete copy as well. Everything for the production server is hosted on the same machine so there aren't any firewall or internet issues.
The first connection profile has the following call stack:
ADOConnecton->Connect
ADODB_mysql->_connect
php::mysql_connect
The second one:
php::mysqli->mysqli
Any suggestions?
Usually the slowness in (first) connection depend on DNS resolution.
May be:
client to resolve the server name
server to resolve the client name to match an access rule
let the client/server let know the server/client address using the host file:
http://en.wikipedia.org/wiki/Hosts_(file)
I edited the Mysql my.ini to change the mysql service to only bind to the IPV4 loopback adapter.
[mysqld]
...
bind=127.0.0.1
I also changed the \public_html\conf\face.ini to use the IPV4 loopback address instead of local host. (Changed "localhost" to "127.0.0.1")
After that all issues went away. I'm not sure if it is because the machine has a half dozen IP addresses or its trying to decide whether to use IPV6 or IPV4.

setting up remotely accessible wamp server along with iis

I am new to Windows IIS and I need to run a php/mysql application on it. For local php development on windows, I have found WAMP to be the easiest.
But can WAMP be used in this case instead of installing php and mysql separately ?
This needs to be done on an ec2 Windows 2003 instance. So far, I have already tried installing WAMP and setting up apache to listen on port 8080 instead of 80. From inside the remote desktop, both IIS and WAMP work properly in parallel on their respective ports.
However, when I try to connect from another computer using the ip address http://184.**.***.***, IIS works fine serving the default web page but cannot connect to apache on http://184.**.***.***:8080.
Is it possible to use WAMP at all for this purpose and if yes, would there be any disadvantages in using it instead of installing php/mysql seperately ?
Edit :
I dont know if this is a problem of blocked 8080 port. To verify this I stopped IIS and configured apache to listen to 80. Even then http://184.**.***.*** doent show the WAMP homepage. IS anything needed to be configured in IIS ?
RESOLVED :
Added the port 80 in Windows Firewall Exceptions and it started working.
Also, its necessary to select "Put Online" in the WAMP tray otherwise it gives a forbidden response as suggested by some answers.
Thanks
I haven't used EC2 in this way before, but broadly speaking, I'd encourage you to use the same server for development and production environments if at all possible - the installation effort can be a bit of a pain, but it's nothing compared to developing an app locally and then finding an IIS configuration issue causes it to break on production.
This approach also lets you keep your PHP configurations in source code control - php.ini and any modules you're using - and automatically deploy them alongside your application; again, forgetting to deploy the correct PHP.ini usually makes your application do crazy things...
So, your choices appear to be:
- switch off IIS and have WAMP listen to port 80. Not sure WAMP is designed for production level traffic, but in the past, I've run low-traffic public websites in this way.
- work out why port 8080 is blocked, and if it can be unblocked. This would still require you to run your website on an unusual port, which makes for ugly and hard-to-communicate URLs.
- install PHP on your IIS instance. One benefit of having installed WAMP is that MySQL should already be up and running, and the basic PHP installation should also be there; getting PHP to run on IIS is no longer a dark art ([http://php.iis.net][1])
For my money, I'd go for the latter option...IIS is a production quality server, and it's clearly what Amazon want you to use in this instance.
Of course, running IIS on your development environment may be a problem.
Have you put the server online? Think it is offline by default, meaning it's only accessible from your local machine. It's an option in the systray menu to put it online.
If I remember well, there is an option "go public" (or "put online") on the system traya icon of wamp.
This option modifies the httpd.conf to authorize public access.
You should give a try.
On a side note, you can make php work with IIS. This is another option to help you manage your server. (Mysql and Php have to be installed separatly but, this is very easy to do as far as I remember :) )

Categories