Run MySQL and SQL database with PHP on windows - php

I already use wamp(PHP+MySQL) on windows m//c. Now I wan to use SQL database with PHP along with WAMP. Can I use two diff database with PHP on same machine ?

Of course you can, install SQL server database, and change the connection parameter as needed.
You can even use two databases for one project.
Cheers!

Related

Does php 5.6.6 work with mysql 5.6.23?

Or is php 5.4 only compatible with mysql? I've been having some problems getting my php to work with mysql.
I'm using PHP 5.6.6, Apache 2.4, MySQL 5.6.23. My PHP and Apache work just fine. I created a website using CSV. I wanted to learn how to use MySQL, but I was having problems trying to get MySQL to work with my PHP. Now, I have never take any courses on MySQL nor have I ever used. The only thing I have done with MySQL is install it from the community tab from the MYSQL download page. I followed all the instruction and set my file path to be C:\mysql, and my data path to be C:\mysqldata, but I don't know, why it doesn't seem to work with my php when I try to connect. Is there another step I have to take to connect? I know a lot of people use WAMP, which is something I might look into if I don't get this working, but If there's anyone who has installed all three (apache php and mysql) sperately, know what my problem might be, I'll really appreciate it.
PDO works on all PHP versions 5.1+, which is the preferred method to connect to MySQL.

If I create a database in MySQL using terminal, should it show under my databases in PhpMyAdmin?

Total beginner to the world of MySQL and PHP (using MAMP).
Very simple question which I can not seem to find the answer to anywhere.
I have created a MySQL database (called user_info) in terminal under the 'root' user on 'localhost' with all permissions/privileges granted, when I access PhpMyAdmin as root user on localhost (which is what it says under the database server pane) I can't see the database I created in terminal in the left hand pane or under the databases tab of PhpMyAdmin ?
The question is really whether the databases created in terminal should reflect in the databases section in PhpMyAdmin or is this a total mis-understanding of the way it all works on my part ?
Any advice or explanation would be greatly appreciated !
Kind regards
It looks like you have two MySQL installations on your Mac. MAMP comes with MySQL and it looks like you also installed another MySQL outside of MAMP. This explains the two different data directories -- the MAMP MySQL is using /Applications/MAMP/db/mysql/ and the other installation is using 'usr/local/mysql/data/`.
Pick one to keep and remove the other one. You can force your client to connect to whichever one you want, by specifying the port or socket each one is using to listen for connections, but unless you have a specific reason for wanting to run two MySQL instances, it's going to be less confusing to remove one. Just make sure you don't have any stored data that you wish to save (or export/dump it to SQL first).
I came across the same issue when playing with MAMP.
And I finally find out that I have two MySQL installations on my Mac, just like Issac said.
One is installed individually, under /usr/local/mysql, and the other is installed together with MAMP, under /Applications/MAMP/Library/bin
So to see what is seen in phpmyadmin, I need to connect with the MAMP one.
hope this helps.

Use MySQL database like SQLite in PHP

Im developing a little web application with PHP and MySQL but in the computer that im working, i cannot install Database Servers like SQL Server or MySQL Server.
I've worked with SQLITE and its amazing, NO INSTALL just the DABATASE AND THE CORRECT LIBRARIES.
DO you know if there's a way to work like this with MySQL Databases ?
Thanks.
NOTE: I 've tried .sdf of Microsoft SQL COmpact but i dont wanna use Microsoft products for now.
Not possible. MySQL is not a file based Database.
Yeah, you have to install MySQL (if you want MySQL) like you install Php in your computer.
Or you can get both of them in one app like: http://sourceforge.net/projects/xampp/
Is these what you want?

How to migrate from my WAMP environment to using MSSQL?

I have on my local PC installed WAMP environment (using WampServer OS).
Now I would need to change one script from working with MySQL to MSSQL.
I have no idea at all how to proceed, where to download MSSQL, how to install it and how to connect with PHP?
Thank you very much
Download mssql express http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx
Familiarize yourself with one of the great database abstraction layers, for example PDO http://www.php.net/pdo
Refactor your code to use the database abstraction layer
You may need to rewrite the mysql specific things to "standard" SQL
Start by getting Sql Server working. If you are using an old copy of Sql Server (pre 2005) you will need to make sure ntwdblib.dll is present in your System32 directory, and removed from your PHP dll directory (ntwdblib.dll is installed with the enterprise tools, so you may have to install them on your PHP box as well). Once you have Mssql querying properly, start finding where Mssql differs from MySql in your code.
A couple of tips:
The ntwdblib doesn't accept long strings (I think it is limited to 4k, but don't quote me on that). You have to use Stored Procs if you are trying to process a string longer than 4k.
Try to use Sql Server 2005 if you can (see above), the ntwdblib.dll is ancient and has numerous issues.
The PHP site is your friend for mssql.

Connecting to Oracle using PHP

How do I connect to a remote Oracle database instance from PHP?
I need to query (read only) the remote Oracle database for some information; do I need to have an Oracle Instant Client installed?
Is the OCI extension for PHP enough?
From PHP Manual
You will need the Oracle client libraries to use this extension.
The most convenient way to install all the required files is to use Oracle Instant Client, which is available from Oracle's site
The best manual for using PHP with Oracle is Underground PHP Oracle Manual. Periodically updated. For example last update describe new cool OCI (Oracle Call Interface) features. I found it by accident and since then has never regretted. Start from that good manual.
there are a couple of steps you need to go through to make this work.
First, you need to install the oracle driver for whatever OS you have. Then, create a DSN for odbc to use to connect the php function call to the oracle database. On windows, you can find this on the Control Panel -> ODBC Sources
Once you have done this, restart the DB, the web server and then you should be able to test it all with this:
odbc_connect($dsn,$user,$pass);
If you have linux, the same steps are needed but I'm not sure how you create a DSN in unix.
I saw this in the "Notes" section of the PHP documentation:
If you're using PHP with Oracle Instant Client, you can use easy connect naming method (...)
So I think it's rather clear that you can connect to an Oracle DB without the Oracle Instant Client, using only the PHP Oracle extension.
If you're attempting to connect to oracle on ubuntu with PHP, the following links have been more than helpful:
A) http://pecl.php.net/bugs/bug.php?id=9253
That's the real-workhorse one - it gives you just about all the data you need.
B) http://fabrizioballiano.net/2008/01/26/how-to-install-php-pdo_oci-on-ubuntu-gutsy/
This is also helpful for details of things that need to be installed for oracle to work with ubuntu.
If you're using it with PHP, you'll need to make sure that the TNS_ADMIN and ORACLE_HOME environment variables are available for apache's user - there's a file named 'envvars' in the apache2 directory where you can set these. (For my own ease of use, I have the two point to the same directory.)

Categories