Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Using PHP with MySQL Connecting PHP to MySQL Handling Exceptions

How do i find out the port number i should use for my website?

simple question

3 Answers

You can also run the following SQL query in MySQL console or phpMyAdmin -> Query window to get the port number:

SHOW VARIABLES WHERE variable_name = 'port';

Hi trisha,

Port number for what? Different services use different ports. The apache web port is probably 80. Are you talking about a hosting service?

Put this in a file, call it whatever you want as long as it has a php extension. I just name mine phpinfo.php. Put this on your website and run it from your browser. It will give you more info than you will ever use.



im trying to find out the port number to use when connect to my database example the one for MAMP =8889

I'm not a Mac user (Linux) but I believe 8889 is correct. You can still use the script I provided above. Since you get so much information, use the browser find function and enter mysql.

that worked thank you :)