Simple PHP question (I hope!)

4 posts / 0 new
Last post
Offline
Last seen: 6 years 8 months ago
Joined: Apr 22 2004 - 15:37
Simple PHP question (I hope!)

I'm going through a book on PHP and am on a chapter for dealing with MySQL database files. The first example goes through opening the database file and throwing an error when it can't do so. When I try to run it the server appears to stop interpreting PHP as PHP and displays the rest of the block as HTML. I would try to show it on here but the last time I tried the post was rejected.

It's similar to the first example listed on this page:

http://www.php.net/manual/en/function.mysql-connect.php

I have tried it on Linux, Windows, and Tiger with the same results. It's really difficult to try to learn something when you can't get the environment to work properly.

Eudimorphodon's picture
Offline
Last seen: 2 weeks 6 days ago
Joined: Dec 21 2003 - 14:14
So...

First step: Make a tiny php script that only runs the "phpinfo();" command. Check the output, and see if you actually have the mysql libraries installed.

Beyond that I couldn't comment without more info.

--Peace

Offline
Last seen: 6 years 8 months ago
Joined: Apr 22 2004 - 15:37
Here you go

This is copied from the result of phpinfo. I have not tried a MAMP server yet. These results are from the Vertrigo WAMP server (open source).

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 5.0.45

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off

mysqli
MysqlI Support enabled
Client API library version 5.0.45
Client API header version 5.0.45
MYSQLI_SOCKET /tmp/mysql.sock

Directive Local Value Master Value
mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.reconnect Off Off

Offline
Last seen: 6 years 8 months ago
Joined: Apr 22 2004 - 15:37
Finally works!

I installed a MAMP package to my Blue/White G4 and so far it works. It seems strange that it didn't work using a WAMP package and installing the packages in Ubuntu.

Log in or register to post comments