Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5101

Re: php PDO does not work

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: php PDO does not work
Date 2012-03-03 12:59 -0500
Organization A noiseless patient Spider
Message-ID <jitm60$nq2$1@dont-email.me> (permalink)
References <427252.950.1330787450521.JavaMail.geo-discussion-forums@pbcwi5>

Show all headers | View raw


On 3/3/2012 10:10 AM, test japan wrote:
> i installed php and mysql on archlinux by pacman,
> and in phpinfo page, i can see the infomation about mysql&  pdo_mysql
>
> in php.ini, i uncommented the following lines:
> extension=mysqli.so
> extension=mysql.so
> extension=pdo_mysql.so
>
> but when running the code below, the browser shows a blank page
> no result, even no error message.
>
>      try {
>          $dbh = new PDO("mysql:host=192.168.0.1;dbname=testdb", "username", "password");
>          echo 'Connected to database!!';
>      } catch (PDOException ex) {
>          echo $ex->getMessage();
>
>
> anyone can help me?
> thanks!

On your development system, enable error reporting and display the 
errors.  In your php.ini file you should have:

error_reporting = E_ALL
display_errors = on

Note you do NOT want to have display_errors=on in a production 
environment, and should log the errors instead.

Once you fix the syntax error(s) (Luuk found one - don't know if you 
have any others), you shouldn't get a blank page.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

php PDO does not work test japan <testatjapan@gmail.com> - 2012-03-03 07:10 -0800
  Re: php PDO does not work Luuk <luuk@invalid.lan> - 2012-03-03 16:34 +0100
  Re: php PDO does not work Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-03 12:59 -0500
    Re: php PDO does not work test japan <testatjapan@gmail.com> - 2012-03-03 17:08 -0800
  Re: php PDO does not work "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-03-05 10:23 +0100
    Re: php PDO does not work Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-05 08:04 -0500

csiph-web