You are here: Re: PHP 5.2 and Mysql « PHP Programming Language « IT news, forums, messages
Re: PHP 5.2 and Mysql

Posted by Jerry Stuckle on 11/21/06 21:17

eholz1 wrote:
> On Nov 20, 6:44 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>
>>Eric wrote:
>>
>>>Jerry Stuckle wrote:
>>
>>>>eholz1 wrote:
>>
>>>>>Hello Newsgroup,
>>>>>I have redhat 3.0 Enterprise, and mysql (3.58.xxx more or less)
>>>>>installed from a redhat rpm,
>>>>>and php 4.3.9 (installed from an rpm) - I can access data from my mysql
>>>>>db using php and the "pear" Db .php. I recently upgraded my Apache to
>>>>>2.2 and installed (more or less) PHP 5.2 as well - neither of these
>>>>>installs were from a Redhat rpm, I downloaded the tarballs, extracted,
>>>>>configed, make, etc.
>>>>>Apache seems to work fine (but not with the php 4.3.9 rpm). I set the
>>>>>httpd.conf file to access php 5 (libphp5.so) and can display PHP 5.2.0
>>>>>info using phpinfo(). But... I cannot access any data in my mysql
>>>>>database (/usr/local/share/DB.php) from the "pear". And it does not
>>>>>appear that phpinfo() is reading the php.ini file. I have two php.ini
>>>>>files, one in /etc (redhat rpm location), and another in
>>>>>/usr/local/lib/php.ini. I have edited and changed both these files,
>>>>>but the "changed" items (like default
>>>>>mysql.socket=/var/lib/mysql/mysql.sock) do not show up in the phpinfo()
>>>>>page. I have even renamed each php.ini file so there is no php.ini
>>>>>file (like php_ini), and the phpinfo() data still displays! this is in
>>>>>php 5.2.0. In 4.3.9 - all is well - the file (/etc/php.ini) is read,
>>>>>etc, and I can access the db.
>>
>>>>>I have attempted to set the PHP 5.2 switch to the location where my
>>>>>mysql binary is (/usr/bin/mysql), but still nothing seems to work. My
>>>>>guess is that I am not selecting the correct place for PHP 5.2 to hook
>>>>>up with my already installed (but old) redhat my sql rpm.
>>
>>>>>Any ideas on how I can get PHP 5.2 to work with my version of mysql?
>>>>>Or should I remove the existing mysql rpm, and start fresh with a later
>>>>>version of mysql - and install it from tarball, etc Then I would at
>>>>>least know where the mysql stuff is. Redhat seems to spread the
>>>>>package info all over the place.
>>
>>>>>Help!
>>
>>>>>eric jones
>>
>>>>What does phpinfo() show for the path to your php.ini file?
>>
>>>Hello I did check the location - and moved the php.ini file to this
>>>location - /usr/local/apache2/php/lib - now it reads the file (php).
>>
>>>I still am unable to connect to the db -my my.cnf file seems ok.
>>>I will make a change to my php page that accesses the db.
>>
>>>If I run the older version of apache (2.0) and php 4.3.9 - all is well -
>>>i can diplay data on the php page.
>>
>>>any ideas here???
>>
>>>Thanks,
>>
>>>eholz1It would help if you would tell us what errors you're getting.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstuck...@attglobal.net
>>==================
>
>
> Hello Again,
>
> Thanks for checking my post. Well, as to errors - I am not getting
> any. I will double check the php page that is supposed to access the
> db.
> I do a "SELECT * FROM pet" and display about 10 records. I will double
> check to see if I do any error checking, etc.
>
> Below is the php code to connect to the database:
> <table class="maintable" border=1>
> <tr class="rowbar"><th>Pet Name</th><th>Owner</th><th>Pet
> Type</th><th>Gender</th><th>Date of Birth</th></tr>
> <?php
> // connect
> require_once('DB.php');
> $db = DB::connect("mysql://abc:password@myserver/menagerie");
> $dbhost = 'myserver';
> $dbuser = 'abc';
> $dbpass = 'password';
>
> if (DB::iserror($db))
> die($db->getMessage());
> //else
> // echo 'Congratulatons! Connected to Database!<br></br>';
>
> ?><!--center-->
> <?php
> $sql = "SELECT * FROM pet";
> $q = $db->query($sql);
> if (DB::iserror($q)) {
> die($db->getMessage());
> }
>
> // generate the table
> while ($q->fetchInto($row)) {
> ?>
> <tr>
> <td><?= $row[0] ?></td>
> <td><?= $row[1] ?></td>
> <td><?= $row[2] ?></td>
> <td><?= $row[3] ?></td>
> <td><?= $row[4] ?></td>
> </tr>
> <?php }
> ?>
> </table></center>
>
> This code works fine when I am running the older Apache (2.0), and PHP
> 4.3.9.
>
> Thanks,
>
> eric
>

(top posting fixed)

Hmmm, this shouldn't be a problem. What happens if you use MySQL calls?

I don't use Pear::MDB2, but I wonder if the version you have is not
compatible with PHP 5.2. I really don't know - it's just a shot in the
dark.

P.S. Please don't top post. Thanks.

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация