[PHP] Re: catch the error
Hi PJ, Could it be that you have "//include ("lib/db1.php"); " commented out? Try uncommenting that line and see what happens. The error message will always print because the query is never executing properly if you have the db connections file commented out. On Thu, Feb 26, 2009 at 12:28 PM, PJ wrote: > What is wrond with this file? same identical insert works from console > but not from this file :-( > > > > Untitled > > > > //include ("lib/db1.php"); // Connect to database > mysql_connect('biggie', 'user', 'password', 'test'); > $sql1 = "INSERT INTO example (name, age) VALUES ('Joe Blow', '69')"; > $result1 = mysql_query($sql1,$db); > if (!$result1) { > echo("Error performing 1st query: " . > mysql_error() . ""); > exit(); > } > ?> > > > > > Seems to be good to print out the error message, but that's all. db not > written. > > -- > > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: catch the error
ok, well if that's the case then do this $db = mysql_connect('biggie', 'user', 'password', 'test'); That should fix the problem. On Thu, Feb 26, 2009 at 12:46 PM, PJ wrote: > It is commented out because I am using "mysql_connect" > I don't think it would be good to use both, since the db1 references > another db. But even when I use the db1.php and change the database and > table, I get the same error message. > > But what I did miss is my typo in "What is wrond with this file?" :-) >> Hi PJ, >> Could it be that you have "//include ("lib/db1.php"); " commented >> out? Try uncommenting that line and see what happens. The error >> message will always print because the query is never executing >> properly if you have the db connections file commented out. >> >> On Thu, Feb 26, 2009 at 12:28 PM, PJ wrote: >>> What is wrond with this file? same identical insert works from console >>> but not from this file :-( >>> >>> >>> >>> Untitled >>> >>> >>> >>> >> //include ("lib/db1.php"); // Connect to database >>> mysql_connect('biggie', 'user', 'password', 'test'); >>> $sql1 = "INSERT INTO example (name, age) VALUES ('Joe Blow', '69')"; >>> $result1 = mysql_query($sql1,$db); >>> if (!$result1) { >>> echo("Error performing 1st query: " . >>> mysql_error() . ""); >>> exit(); >>> } >>> ?> >>> >>> >>> >>> >>> Seems to be good to print out the error message, but that's all. db not >>> written. >>> >>> -- >>> >>> Phil Jourdan --- p...@ptahhotep.com >>> http://www.ptahhotep.com >>> http://www.chiccantine.com >>> >>> >>> -- >>> MySQL General Mailing List >>> For list archives: http://lists.mysql.com/mysql >>> To unsubscribe: >>> http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com >>> >>> >> > > > -- > > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: catch the error
Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is trying to help you and that's cool, but EVERYONE on this list may not be so nice. The above credentials is definitely the type of information you want to keep private, unless you don't mind people potentially accessing your database tables and doing whatever they like with them. I suggest doing something like $db_host = 'localhost; $db_user = 'foo'; $db_pass= ''bar; $db_name =''xx; if you are going to post it on the list. On Thu, Feb 26, 2009 at 1:22 PM, PJ wrote: > Ricardo Dias Marques wrote: >> Hi PJ, >> >> On Thu, Feb 26, 2009 at 17:28, PJ wrote: >> >> >>> What is wrond with this file? same identical insert works from console >>> but not from this file :-( >>> >>> [snip] >>> >>> >> //include ("lib/db1.php"); // Connect to database >>> mysql_connect('biggie', 'user', 'password', 'test'); >>> $sql1 = "INSERT INTO example (name, age) VALUES ('Joe Blow', '69')"; >>> $result1 = mysql_query($sql1,$db); >>> if (!$result1) { >>> echo("Error performing 1st query: " . >>> mysql_error() . ""); >>> exit(); >>> } >>> ?> >>> >> >> I haven't coded in PHP for a long time, but I think that your problem >> is in this line: >> >> $result1 = mysql_query($sql1,$db); >> >> Up to that point, $db (that should point to a database link >> identifier) is not defined. You probably want to assign the >> "mysql_connect" result to that $db variable. >> >> >> So, I think that you will solve your problem by changing your >> "mysql_connect" line FROM the current form: >> >> mysql_connect('biggie', 'user', 'password', 'test'); >> >> .. TO this one: >> >> $db = mysql_connect('biggie', 'user', 'password', 'test'); >> >> >> Am I right? > Partly. I had an error in the location of the include. Ashley corrected > the rest but it only works with the include. Not as whown below > //include ("../lib/db1.php"); // Connect to database > > $db_host = 'biggie'; > $db_user = 'root'; > $db_pass = 'gu...@#$'; > $db_name = 'biblane'; > > $db_connect = mysql_connect($db_host, $db_user, $db_pass); > $db_select = mysql_select_db($db_name, $db_connect); > > $sql1 = "INSERT INTO test (name, age) VALUES ('Arnie Shwartz', '75')"; > $result1 = mysql_query($sql1,$db); > if (!$result1) { > echo("Error performing 1st query: " . > mysql_error() . ""); > exit(); > } > ?> > > -- > > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: catch the error
Additionally regarding the error handling , add this to the op of your script. ini_set("display_errors","true"); error_reporting(E_STRICT|E_ALL); and post the output of your error message. On Thu, Feb 26, 2009 at 1:40 PM, Ashley Sheridan wrote: > On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: >> Hi PJ, >> $db_host = 'biggie'; >> $db_user = 'root'; >> $db_pass = 'gu...@#$'; >> $db_name = 'biblane'; >> >> >> >> Everyone here is trying to help you and that's cool, but EVERYONE on >> this list may not be so nice. The above credentials is definitely the >> type of information you want to keep private, unless you don't mind >> people potentially accessing your database tables and doing whatever >> they like with them. >> >> I suggest doing something like >> $db_host = 'localhost; >> $db_user = 'foo'; >> $db_pass= ''bar; >> $db_name =''xx; >> >> if you are going to post it on the list. >> >> On Thu, Feb 26, 2009 at 1:22 PM, PJ wrote: >> > Ricardo Dias Marques wrote: >> >> Hi PJ, >> >> >> >> On Thu, Feb 26, 2009 at 17:28, PJ wrote: >> >> >> >> >> >>> What is wrond with this file? same identical insert works from console >> >>> but not from this file :-( >> >>> >> >>> [snip] >> >>> >> >>> > >>> //include ("lib/db1.php"); // Connect to database >> >>> mysql_connect('biggie', 'user', 'password', 'test'); >> >>> $sql1 = "INSERT INTO example (name, age) VALUES ('Joe Blow', '69')"; >> >>> $result1 = mysql_query($sql1,$db); >> >>> if (!$result1) { >> >>> echo("Error performing 1st query: " . >> >>> mysql_error() . ""); >> >>> exit(); >> >>> } >> >>> ?> >> >>> >> >> >> >> I haven't coded in PHP for a long time, but I think that your problem >> >> is in this line: >> >> >> >> $result1 = mysql_query($sql1,$db); >> >> >> >> Up to that point, $db (that should point to a database link >> >> identifier) is not defined. You probably want to assign the >> >> "mysql_connect" result to that $db variable. >> >> >> >> >> >> So, I think that you will solve your problem by changing your >> >> "mysql_connect" line FROM the current form: >> >> >> >> mysql_connect('biggie', 'user', 'password', 'test'); >> >> >> >> .. TO this one: >> >> >> >> $db = mysql_connect('biggie', 'user', 'password', 'test'); >> >> >> >> >> >> Am I right? >> > Partly. I had an error in the location of the include. Ashley corrected >> > the rest but it only works with the include. Not as whown below >> > > > //include ("../lib/db1.php"); // Connect to database >> > >> > $db_host = 'biggie'; >> > $db_user = 'root'; >> > $db_pass = 'gu...@#$'; >> > $db_name = 'biblane'; >> > >> > $db_connect = mysql_connect($db_host, $db_user, $db_pass); >> > $db_select = mysql_select_db($db_name, $db_connect); >> > >> > $sql1 = "INSERT INTO test (name, age) VALUES ('Arnie Shwartz', '75')"; >> > $result1 = mysql_query($sql1,$db); >> > if (!$result1) { >> > echo("Error performing 1st query: " . >> > mysql_error() . ""); >> > exit(); >> > } >> > ?> >> > >> > -- >> > >> > Phil Jourdan --- p...@ptahhotep.com >> > http://www.ptahhotep.com >> > http://www.chiccantine.com >> > >> > >> > -- >> > MySQL General Mailing List >> > For list archives: http://lists.mysql.com/mysql >> > To unsubscribe: http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com >> > >> > >> > I agree. I wouldn't trust me at all! ;) > > > Ash > www.ashleysheridan.co.uk > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' ....
Hello Everyone, My name is Darryle. I've installed PHP 5.3.9 on my CentOs box and some numerous modules via yum. Some of those modules are PDO, PDO_MYSQL and PDO_SQLITE. However, my PHP configuration is not recognizing my PDO_MYSQL module. I can verify that these modules exists by looking in my /etc/php.d/ folder. I'm also including the PDO and PDO_MYSQL extensions in my httpd.conf file after my extension_dir=/path/to/modules/ declaration. When I run php -i | grep pdo this is what I see ]# php -i | grep pdo PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo' - /usr/lib64/php/modules/php_pdo: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' - /usr/lib64/php/modules/php_pdo_mysql: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 Configure Command => './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/lib64/mysql/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--without-sqlite3' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--with-pspell=shared' '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/usr' '--with-recode=shared,/usr' /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in Unknown on line 0 pdo_sqlite and if I run php -m, this is a sample pf what I see ( I still see the same warnings that I see from above ) pcre PDO pdo_sqlite Phar What do I need to do to make my php configuration recognize my pdp_mysql module? Being that's i'm a LAMP Developer, I have frameworks that I use that require PDO_MYSQL to exist. -- -- "May the Source be with you." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' ....
I have version usr/lib64/mysql/libmysqlclient.so.18 instead of usr/lib64mysql//libmysqlclient.so.15 . I coped over the file into usr/lib64/libmysqlclient.so.18, because that file didn't exist in that path, I created the sym link but no luck. Few fixes are better than no fixes for sure. On Wed, Feb 1, 2012 at 6:44 PM, Matijn Woudt wrote: > On Wed, Feb 1, 2012 at 6:56 PM, Darryle Steplight > wrote: >> Hello Everyone, >> My name is Darryle. I've installed PHP 5.3.9 on my CentOs box and >> some numerous modules via yum. Some of those modules are PDO, >> PDO_MYSQL and PDO_SQLITE. However, my PHP configuration is not >> recognizing my PDO_MYSQL module. I can verify that these modules >> exists by looking in my /etc/php.d/ folder. I'm also including the >> PDO and PDO_MYSQL extensions in my httpd.conf file after my >> extension_dir=/path/to/modules/ declaration. When I run php -i | grep >> pdo this is what I see >> >> >> ]# php -i | grep pdo >> PHP Warning: PHP Startup: Unable to load dynamic library >> '/usr/lib64/php/modules/php_pdo' - /usr/lib64/php/modules/php_pdo: >> cannot open shared object file: No such file or directory in Unknown >> on line 0 >> PHP Warning: PHP Startup: Unable to load dynamic library >> '/usr/lib64/php/modules/php_pdo_mysql' - >> /usr/lib64/php/modules/php_pdo_mysql: cannot open shared object file: >> No such file or directory in Unknown on line 0 >> PHP Warning: PHP Startup: Unable to load dynamic library >> '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.15: cannot open > > Hi, > > This seems to be an common error with CentOS 64 bit. If you google for > it there are plenty of people experiencing the same issue, and there > are probably a few fixes for it. > One of the first hits I got was a user who did: > > ln -s /usr/lib64/mysql/libmysqlclient.so.15 /usr/lib64/libmysqlclient.so.15 > > And it solved his problem. So you can try that, and if that fails, try Google! > > - Matijn -- -- "May the Source be with you." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php