Configure PHP to work with MySQL and phpMyAdmin - php

My purpose is to setup a forum in php just locally on my Windows 7 machine to test how it works.
I have installed Apache HTTP Server and PHP v5 successfully. Then I downloaded and extracted the phpbb-forum software and put it in my root folder. Then I realized that I needed some kind of database so I downloaded and installed MySQL. To configure my database I also downloaded and extracted phpMyAdmin but I can't get it to work. When I open my browser and navigate to my phpMyAdmin-folder I simply get this:
Screenshot: http://img836.imageshack.us/img836/5139/captureqb.png
I use my Apache server to preview my website where I'm using some php include functions so I know that I've a "working" PHP installation. The MySQL service is also running on my computer.
However, do you need to configure PHP and/or Apache in order to get phpMyAdmin to work properly? I'm a complete noob on this so I suppose it may be multiple shortcomings.
Thank you.. //Realiserad

The simpler way is to install WAMP server : it bundle Apache, PHP, MySQL and PHPMyAdmin preconficurated for work together.

You need to enable the MySQL extension to use MySQL from PHP.
The MySQL extension may or may not be bundled with your PHP distribution. (look for php_mysql.dll in the ext folder)
Assuming it's installed you can enable it by adding or uncommenting this line in your php.ini:
extension=php_mysql.dll
As other people have said it may be simpler to install WAMP Server

Have a look at: http://www.ricocheting.com/how-to-install-on-windows/mysql - Specifically, the 3rd step. It involves downloading the mySQL PHP Extention (which is a dll), and un-commenting a line of php.ini so that PHP Load's the extension.
While is may be simpler to install XAMPP or WAMP, I think that it's good to know how to fix your own problems - Scientia potentia est :D

not very familiar with windows, but it seems like you miss the php-mysql extension, which you can download from here (i think):
http://mysql2.mirrors-r-us.net/downloads/connector/php/index.html
would be alot easier for you to use a preconfigured wamp install like this one (available for win/mac/etc). google "xampp", i'm not allowed to post more than one link due to stackoverflows spam protection.

Configure PHP to Access MySQL
Open the c:\php\php.ini file with your favorite text editor.
Uncomment the following lines by removing the semicolon:
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
save and exit editor
After extracting the archive into phpmyadmin folder, you will have to configure phpmyadmin before you can connect to sql server.
you should create a configuration file. This file can be created manually (simply use a text editor),
During your first session you will see an error message.
To solve this problem you should create folder (C:\project\wwwroot\phpmyadmin\config). After that give full rights for IIS_IUSRS group and IUSR user.granting permission/image
Return to the config window. Visit localhost/phpmyadmin/setup/
To configure the connection settings click on the “New Server” button.
Enter the verbose name of the SQL server, and then the server hostname. If necessary, you can specify other settings.[setting up/image][2]
Save the settings and then the server will redirect us to the previous page. Choose:
the default language – English
the default server – 127.0.0.1
end of the line – Windows (\ r \ n)
Click Save, and then download. The received file (config.inc.php) you should save to the root directory (C:\project\wwwroot\phpmyadmin).
Open the authorization window (//localhost/phpmyadmin/) and login under root account. If you see a starting phpMyAdmin window, you can delete config folder.
For the correct work phpMyAdmin requires a database with the information. The script for creating database is already installed.

Related

phpMyAdmin on macOS: where does it save config.inc.php?

Downloaded the latest phpMyAdmin to be used on macOS 10.15 Catalina (local webserver), extracted the phpMyAdmin files to my web root.
During the setup I chose config authentication and now when I visit the setup page I'm getting some mysqli error.
I deleted the entire phpMyAdmin/ dir and wanted to start all over again. However to my surprise, the previously entered (incorrect) server details are still there.
I would assume the any config.inc.php would be saved within phpMyAdmin's own dir, but apparently it's saving this data somewhere else.
How/where can I find it, so I can delete it and truly start a complete new phpMyAdmin setup from scratch?
P.S. I already tried:
/etc/phpmyadmin/
/usr/local/phpmyadmin/
/usr/local/etc/phpmyadmin/
/usr/local/opt/phpmyadmin/
But neither of these dirs exist.
If you've simply downloaded the phpMyAdmin file yourself and uncompressed it to your web root, then the config.inc.php file goes in that phpMyAdmin folder. If you've used brew or some other package manager, they each have their own location for configuration files, but that doesn't seem to be the case here.
It's not clear why the old server details have been retained, maybe your browser has cached the old page or something, but the only place that phpMyAdmin looks for the configuration is in the main folder. Is there a chance you're seeing the defaults, rather than some custom setting? (The defaults would be to use auth_type cookie connecting to host 'localhost').
What is the specific mysqli error message you're seeing?

php: loading oracle driver gives error "Unable to load dynamic library - The specified procedure could not be found."

I seem to have a strange problem with PHP.
I've migrated a bunch of software from one server to another. On the server some scripts make a connection to Oracle, so to be able to make a connection the oracle client is installed and a tnsnames file is in place. Connection from sql*plus works.
Some of the scripts use PDO, so for that I've enabled extension=php_pdo_oci.dll in php.ini. These scripts work like a charm.
Some other scripts use functions like oci_connect, and these need a extension like php_oci8.dll. With xammp (that I use as apache/php/mysql bundle) php_oci8_12c.dll is delivered, so I thought that extension would be adequate.
When starting the server, I see these errors in the php errorlog:
Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found.
The file is in located in C:\xampp\php\ext\, so that shouldn't be a problem. Other extensions that are in the same dir are picked up without any problems. I've also tried to load php_oci8.dll, wich I picked up from the old server, but got exactly the same problem.
Some answers I found to similar problems I tried without success:
- copying the dll to c:\windows\system
- adding the php ext dir to the system PATH variable
- adding the oracle client to the system PATH variable (was already in there)
The software versions I'm using:
OS: Windows 2012 R2 x64
PHP: 5.6.3
Oracle database: 11.2.0.4.0
Any ideas?
Seems like I figured it out and can answer my own question. It looks like XAMPP is delivering a non-suitable ddl with their distribution.
The right and most recent oci8 dll's are downloadable here in all possible flavors: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/. Once I got the right one, it worked like a charm.
XAMPP comes with PHP compilled with ThreadSafe, so you have to download the file from this directory:
http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/ …
Before you paste the 3 DLLs to C:\xampp\php\ext*, append ".old*" to each file. Be sure you have enabled the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache.

How to repair wamp server without re-installing?

After making changes in php.ini by uncommenting
extension=php_openssl.dll
My Windows-8 system got shutdown due to power failure and later i use to get this error when i try to start wamp server
Later visiting some link i added the below code to wampmanager.ini file as it was empty
Now the first error got fixed and now throwing this error mentioned below:
Later i also installed visual c++ 2008 to fix this error but unsuccessful. I have many important databases which i have not taken back up also. I am trying to repair this wamp server without re-installing. Can anybody please assist me with this.
Thanks in Advance
go to the wamp/scripts folder
open console
run:
php refresh.php
this should recreate wampmanager.ini
(requires wampmanager.tpl file in wamp folder.
taken from http://sourceforge.net/p/wampserver/feature-requests/10/#750b)
This document may help you How to uninstall WAMPServer without actually uninstalling it
The idea is that you uninstall your current version without actually running the unninstall and without actually deleting any files from your existing install.
You then rename the current wamp folder and then install the same version of wamp, make sure it works, and then copy all your sites and databases to the new installed wamp. If you install exactly the version of WAMP you have currently then you can copy the whole of the .../mysqlx.y.z/data folder and all you databases and users should be there on the new install.
This gets over whatever damage was done to your existing install. You may need to edit the php.ini and httpd.conf to match your existing configuration. I suggest you do not do a straight copy of either of these files as that may just get you to where you are now.
Fixed by installing wamp again into the same directory by renaming the older wamp. I just replaced wampmanager.ini file of new to the old one. Earlier it was just a little piece of code i pasted in wampmanager.ini file. But now it is a big one which fixed this issue. Thanks a lot for you guys, your suggestions saved my time. I did not change anything with php.ini also.
Backup all YOUR databases in SQL format and store the backups somewhere safe.
Stop All Services.
Remove the Apache Service.
Remove the MySQL Service.
Exit WAMPServer.
Rename your current \wamp folder to \wamp_old (This is your backup. DONT FORGET THIS STEP)
To all intents and purpose, you have uninstalled WAMPServer now.
7. Download and Install the new WAMPServer version
(32bit is recommended, 64bit is only for geeks and 64bit PHP is not yet fully converted to 64bit)
Change NOTHING! Check it works in its out of the box state.
Clear your browser cache ( CTRL+F5 ) to avoid any funnies with cached content.
Run localhost
Run phpMyAdmin (If asked for a Username and password; username = root / password = (nothing, leave this blank)
Run \wamp\www\testmysql.php. you will need to edit the file and change the "mysql_connect('127.0.0.1', 'root', '')"
If you want to bring some/all of your old versions of Apache/PHP/MySQL into the new WAMPServer
(Remember, one of the big advantages in WAMPServer is the ability to switch between versions of Apache/PHP and MySQL)
Apache: copy \wamp_old\bin\apache\apachex.y.z folder to \wamp\bin\apache\apachex.y.z
PHP: copy \wamp_old\bin\php\phpx.y.z folder to \wamp\bin\php\phpx.y.z
MYSQL: copy \wamp_old\bin\mysql\mysqlx.y.z folder to \wamp\bin\mysql\mysqlx.y.z
To tell WAMPServer about the old version of Apache/PHP/MySQL you just copied across run a "refresh",
right click the wampmanager icon -> Refresh
Give it a few seconds to go find all the new versions.
Compare your old configs with the new configs, move over any of your local change/requirements.
Remember, config parameters change between versions of Apache/PHP/MySQL !
Make sure your old changes are still required, valid, legal. ( Check the upgrade notes provided by all 3 software providers )
If it all goes horribly wrong. Check the bottom of this Doc to see how to unwind all these changes easily if you get problems.
help you
I have had the same issue. I am working with WAMP 2.5 version. The content of "wampmanager.ini" is OK but it's possible that the php path is wrong. Check folders of section [StartupAction], in my case my php version is "php5.5.12". Surely the error message "The directory name is invalid" was for this.
In win10 you can just right click on the wampmanager.ini file in the root and select Restore Previous Version, then just choose one from a few days ago when it worked.
i have similair issue in the morning and searched SO and other forums but none of the solution worked for me.
It was
syntax error on line number 561 (due to MariaDB)
After checking all wamp installation for MariaDB, i find out that file at root: wampmanager.conf contain lines about MariaDB. I removed all of those and then restarted wamp. It worked like charm!
Rename the wamp folder, you can just add a 1 or 0 to somehing like wamp641 then
re-install wamp server
3.copy paste the mysql and project folders from Bin and WWW respectively from the renamed wamp folder to the newly created folder after installation so that you dont loose any database and project files from your previous projects.
4 start your wamp and it should work well.

Adding extensions for MS SQL Server to PHP 5.3.9 ini file causes FastCGI Error on server

I am attempting to get a drupal site to work with SQL Server. I have followed the instructions outlined here to get PHP working. Then I downloaded the drivers here and unpacked them to my PHP/ext folder. I then wrote an awesome php test page consisting of the following piece of code.
<?php phpinfo(); ?>
opened up a web browser and pointed to the file localhost/phpinfo.php. All works wonderfully.
I then opened upt the installed .chm file that came with the php drivers for sql server and made the appropriate changes.
Based on the following from my PHPInfo page:
PHP Extension Build API20090626,TS,VC9
I added the following lines of code to my php.ini file
[PHP_PDO_SQLSRV_53_NTS_VC9]
extension=php_pdo_sqlsrv_53_ts_vc9.dll
[PHP_SQLSRV_53_NTS_VC9]
extension=php_sqlsrv_53_ts_vc9.dll
I then restart IIS and point back to my awesome phpinfo.php file and get the following:
HTTP Error 500.0 - Internal Server Error
C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exited unexpectedly
with some lightweight recommended information on suggested things to look at for resolution. e.g. file access, folder access.
There is no rights issue IIS_IUSRS has execute rights on the PHP/ext folder.
Anyone with ideas on how to resolve this? Am I missing something somewhere to make this work?
You write that you add non thread safe libraries, but instead of php_sqlsrv_53_nts_vc9.dll you add php_sqlsrv_53_ts_vc9.dll. For IIS you should use nts libraries
Most possibly MSVCP100.dll is missing
Download and install:
Microsoft® SQL Server® code name ‘Denali’ Native Client CTP 3
from http://www.microsoft.com/download/en/details.aspx?id=26726

PHP connectivity to Oracle DB

I am currently trying to write a PHP script to connect to an Oracle database. The reason I am using PHP is because I need to connect the Oracle database with my current CRM system, written in PHP/MySQL.
The PHP is hosted on 1&1 hosting, which is an external server. I read that I need to enable the extension php_oci8.dll to connect using oci_connect(), but I cannot do so since I do not have root privileges. Did a search, and couldn't find the DLL either.
Is there any other way around this? Any help greatly appreciated, please let me know if you need more information. Thanks!
1) 1&1 will have Linux, so you will have to use linux names for extensions. In this case name of extension will be php_oci8.so
2) create the php.ini in root directory and put the following line
extension=php_oci8.so
3) create a simple php script with one line to test if it works:
<?php phpinfo(); ?>
Please note -- 1&1 may physically not have that file available on their server (or some additional libraries that may be required by that extension). If the problem just with absence of .so file, then you can provide your own version of it (upload it and put the correct full path to the extension in php.ini)
Useful links: 1) http://faq.1and1.com/scripting_languages_supported/php/6.html 2) http://faq.1and1.com/scripting_languages_supported/php/8.html
According to your problem. first thing is that linux doesn't support .dll file.
You have to install OCI8 extension module in your Apache server.
Follow this link to get easy solution.
http://coffeewithcode.com/2012/09/how-to-install-oracle-libraries-for-php5-on-ubuntu-server/
Please check that there are no blank spaces.
1. put the php.ini and the php_oci8.so in the same folder as where you are going to run the php program that is going to access the database.
2. php.ini contents should look like:
extesion=./php_oci8.so

Categories