1
I have a PHP/Mysql system in which I connect via PDO on the "localhost" host, but I will need to put the IP of the server "xxx.xxx.xxx.xxx" instead of "localhost", the system works but very slow. I don’t know what it might be, both apache and mysql are on the same machine. Any suggestions?
Let me try to understand, in this case the speed test is being done locally, or on an external server?
– MagicHat
I am testing externally, but the speed difference is noticeable. I have run a test now and locally there is no speed difference.
– Wagner Soares
Because then you have to see the connection, the hosting service, if it’s going well at home...
– MagicHat
It’s on its own server that I set up, so its local ip is like 192.168.1.15 ai on Pdo I pass this ip to connect to the localhost instead. Works but too slow
– Wagner Soares
Right, but what’s your connection to it, what kind of cable you’re using... and the server conf, the cpu, the network card.... You have to put everything tim tim by tim tim, to be able to evaluate.... The configuration, the OS... QQ that talk is a long shot... You can hit an innocent...;)
– MagicHat
Like this depending on the cable that is using the board to correct, but it’s been a while... This is one of the possibilities....
– MagicHat
The BD consultation will be faster local because the two services are working on the same staff. In my opinion, I think the problem is not in the way that it is making the connection of the system to the database, but in its data bandwidth server. I advise you to add/exchange TAGS for something more server related.
– LucaoA
As they are on the same machine you do not prefer to connect the socket?
– Israel Zebulon
I think it’s unclear. Apache and Mysql are on the same machine. Php connects localhost, the ip of this same machine is 192.168.1.15. I changed the configuration instead of informing "localhost" to the PDO I am informing the IP 192.168.1.15 which is the "localhost" itself. But it gets slow. I only have a machine, there is no other server. It was clear?
– Wagner Soares
I’m making the connection like this: .
new PDO($this->dbType.":host=localhost;dbname=".$_SESSION['cliente'], $this->user, $this->senha ...
. Ai changed to: .new PDO($this->dbType.":host=192.168.1.15;dbname=".$_SESSION['cliente'], $this->user, $this->senha, ...
– Wagner Soares