Can't Connect to Database via PHP

3 replies [Last post]
Last seen: 2 years 11 weeks ago
Joined: 2013-04-06

(trying to connect via tcp:// in C:...\database.php on line 10"

I'm following along with the PhP Programming videos and I've tried re installing Drupal Dev Desktop to accomplish exactly what's being done in the videos but I keep hitting this brick wall. I tried looking online for some help but perhaps I missed a step? My url and database are set up the same way as in the videos:

// Replace with the username and password you used for PhpMyAdmin.
$server = 'localhost';
$username = 'drupaluser';
$password = '';
$database = 'my_database';

So what's wrong?
* 6:03 - How to connect to a MySQL database with PHP

Last seen: 4 years 43 weeks ago
Joined: 2015-11-03
did you ever figure this out?

did you ever figure this out? I am having the same problem

Last seen: 6 years 5 days ago
Joined: 2015-08-12
also running into this problem

I'm encountering the same issue. I'm new to PHP and googled around and still haven't resolved this issue.

Chris Shattuck
Last seen: 4 weeks 3 days ago
Joined: 2009-08-16
Hey folks, If you run into

Hey folks,

If you run into this problem, it's possible that the version of PHP you're using has deprecated the mysql functions. Here's what one user said solved their problem:

"After looking through my php error log, I discovered the issue. Apparently the version of PHP I am using no longer accepts the mysql_connect function, but instead uses mysqli extension. Once I replaced all the relevant functions, I was able to connect to my database, no problem! Thanks for the quick response, regardless."

I hope that helps!

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.