Connect Mysql hosted on another server

Asked

Viewed 898 times

-1

I have Centos installed with php+apache working

this centos is local but I want to use this local server to connect to a mysql database on an internet server.

I have Firebird installed in this centos, and I can connect to it normally.

When I try to connect to Mysql this error.

Fatal error: Call to undefined function mysql_connect() in 

Note. the connection file works correctly on the server that is on the internet.

  • 1

    If it is a very new php this function doesn’t even exist. Try mysqli_connect(). Obs: as you already have some questions on the site, I think it’s good to start formatting better and be clearer by putting all the relevant details (versions, how you’re testing, etc), so you can better enjoy the site. These links here can help: [Ask] and Community FAQ

  • Check the php versions of both servers. You can do it this way, create a file with this content: <?php phpinfo();.

  • 1

    in phpinfo() I only found this reference to mysql '-without-mysql'

  • This might help http://stackoverflow.com/a/13825555/1342547

1 answer

1


What happens is that your PHP is not supported by Mysql - based on --without-mysql.

If it is a Linux environment, you will need to install the php5-mysql package.

Remember also two other details:

  1. Your Mysql user needs to have privileges for external access
  2. Consider using the PDO class for database manipulation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.