Title: PHP Include/Database Error
Last modified: August 19, 2016

---

# PHP Include/Database Error

 *  [granata](https://wordpress.org/support/users/granata/)
 * (@granata)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/php-includedatabase-error/)
 * I have a simple PHP script that I wrote that fetches an entry count from a database
   not related to my WP install. I have called this script from within my WP template
   using the include tag but I get the following error:
 * `Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL
   server through socket...`
 * If I include the script in a plain old HTML document it works like a charm.
 * Any help with this would be much appreciated. This is for a personal project.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [granata](https://wordpress.org/support/users/granata/)
 * (@granata)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/php-includedatabase-error/#post-953131)
 * Anybody know what the problem could be?
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [17 years, 4 months ago](https://wordpress.org/support/topic/php-includedatabase-error/#post-953132)
 * Without seeing the script … no.
 *  [vomers](https://wordpress.org/support/users/vomers/)
 * (@vomers)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/php-includedatabase-error/#post-953133)
 * This article might help. Mainly it states that the location of your socket file
   might not be in a standard location.
 * [http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/](http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/)
 * Hope this helps.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Include/Database Error’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [vomers](https://wordpress.org/support/users/vomers/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/php-includedatabase-error/#post-953133)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
