Hi there guys
first post and first mess for me :rolleyes: !!
I recently got the italian version of "php mysql novice to ninja", 5th edition by Kevin Yank... so far I just love the book.
I decided to go through the painful process of setting up everything needed in the manual way... I am kind new to linux, so I figured out that could be a good way to learn...
so I set up a linux mint vm on my win7 laptop. the vm works flawlessly, as far as I can see.
I installed mysql, php and apache according to the instructions found at the end of the book.
I can connect to apache server from the host without problems, I tried to execute some simple php script (input name and check, echo the date ... simple things) and they run without problems.
I added a user to connect to mysql from the host (I know it is not really reccomended, but as I told you, it is all about learning) and from the host I can connect to mysql on the vm using mysql workbench.
I hit a wall, thought, when creating my first pdo object, since I get the funny "could not find driver" msg.
I searched both these forums and internet in general for some ideas, but of course the answers are kind of deeper than I can understand. Somewhere I read it is a good idea to echo the result of "phpinfo()", and I did it. there is a section named "pdo", a table whose headers is "pdo drivers"... and the table contains only 1 row, that is "sqlite". funny thing, if I change the php code line I use to create the pdo object, and write sqlite instead of mysql, the error turns from "could not find driver" to "database not found": of course, I did not set up the database under sqlite, but under mysql...
so guys, I can see the description I gave you of the situation is far from complete... but still, can any1 help or point me in the right direction? as I understand, I should "install mysql driver" for php... Did I get it right? and what is the procedure to install them? has any1 tried the manual installation of apache - mysql -php as explained in the book? can any1 give me any tip?
thanx for your attention
You may need to manually enable the PDO extension in the php.ini file; if you're sure it's installed try adding:
To your php.ini file.
Can you tell us the configure options you used when installing PHP? These should be available in the phpinfo script right at the top of the file.
ok as a first thanx for the reply
I have a row entitled configure command, is that the one you are referring to??
Configure Command './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysqli=/usr/local/mysql/bin/mysql_config'
and actually a "mysql_config" file is present under /usr/local/mysql/bin/
about the extension, that is somehow puzzling me. I found a section of php.ini with a bunch of "extension", and I tried to "uncomment" the extension=php_mysql.dll, but nothing changed, and honestly I was expecting it: dll is related to windows :/
I tried to add the rows you wrote to me after all those "extension" but nothing really changed.
on the other hand I noticed there is a note before the extension section, it states that if I do not provide a path php is going to search for the extension in the default extension directory.
my phpinfo states
and if I surf that dir I just find a opcache.so file.
is that the problem? do I have to point at another dir? should I copy the mysql.so extension from somewhere?
if these are n00b questions please forgive me
You need to reboot the server after making any changes to php.ini for the changes to take affect
I thought so so I edited the changes before running the server...
I did something else
if I launch from /usr/local
find . -iname "*.so" -follow
terminal gives me a number of files...
but if I type
find . -iname "mysql.so" -follow
find . -iname "pdo.so" -follow
I get nothing in return.
does that mean that I have both php and mysql but I am missing pdo driver for mysql?? =)
In your php.ini file does this line:
have a ; at the start of it? If it does, remove the ; from the start of that line, save, then reboot the server
did it, no go :/
but still, under phpinfo section "pdo" all I get is...
PDO support enabled
PDO drivers sqlite
Will it be a DLL file for a Linux install? Or should it be as below?
well, AFAIK dll are related to windows world, I never "met" a dll extension in linux. but I am kinda new around here, it might just be it a matter of time
I found both a pdo and a mysqli dir
but they both contain 2 .h file each.
so more and more it seems like I did not install a required package. but the question is: wich one??
one step forward YEES
I added a foreach cycle at the start of the page (nothing special, just copied it from some page around)
for each (PDO::getAvailableDrivers() as $driver)
echo "<p>driver:". $driver ."</p>";
and of course, the only line I got was driver: sqlite
then I checked on mysql site
they say mysql driver is natively included into php starting from version 5.5
so I stopped apache,
got into the dir where I had downloaded php
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd
then I restarted apache... and YES
the page now lists
and the error is no more "could not find driver"
"Access denied for user" ...
which is still a bit weird, but it seems like a step forward !!
now guys, a couple of questions:
1 is the book to be corrected? should I try to get in touch with mr. Kevin Yank and relate to him my experience?
2 what exactly did I do? why did I have to use the native driver instead of the mysql config??
This topic is now closed. New replies are no longer allowed.