Getting error as internet explorer can not display web page in PHP - php

I have installed WAMP server for PHP. MySQL extensions are enabled. I have written echo "hi" and run it on WAMP , it did show me proper output as Hi. When I use following snippet:
mysql_connect("localhost","root","")
I get message as Internet explorer can not displays web page.User Id and password are correct.
Replacing localhost with 127.0.0.1:3306 does not resolve this issue.

From what you posted in comments, it looms like the MySQL module might not be activated in your php configuration (php.ini).
To check this, write a blank page and put 'phpinfo();' in there. Look for installed modules and check whether MySQL is in there.
If not, edit your configuration accordingly.

Related

As I am using the local hosting of MAMP but " There has been a critical error on this website" this is error is coming. What should I do?

As I am using the local hosting of MAMPbut " There has been a critical error on this website" this is error is coming. What should I do?
Diagnostic steps worth giving a shot, follow from top to bottom order;
Is MAMP really running with Web server (and additionally the database server)?
Do you see the default MAMP index/home screen?
Put a simple HELLO WORLD HTML document to your project root and check if you can see it on browser
Put a simple HELLO WORLD PHP script to your project root and check if you can see it on browser
At this point, if everything above went well, it is definitely an issue with your actual PHP script, check the PHP error log file
Put an INFO.PHP PHP script at your project root and check you have all the required extensions available for your PHP project
Check if database connection is working (if required)
At this point, I cannot imagine what else would go wrong, try PHP debugger (xDebug needs to be installed with MAMP and your PHP editor may need a configuration for this) with break points and step into each line of your PHP code with debugger.

How can I check if I have mysqli in my web server using cPanel?

I'm using...
PHP version 5.4.28
Filezilla
Wordpress
cPanel
MediaTemple hosting
I get this error Fatal error: Call to undefined function mysqli_connect(),
after trying to connect to my database with mysqli functions. I've read online that either mysqli isn't enabled, it may not be installed. I know I have to check my php.ini file located in /usr/local/lib/, but I don't how know look for that. I'm using cPanel's WHM and it looks like this... cpanel WHM
Any suggestions?
If you have WHM you can see and install PHP modules via Easy Apache.
1) Search "Easy Apache" in search box of WHM
2) Click "show more" from DEFAULT profile.
3) You can see all installed modules. Check for MySQL Improved. It's mysqli.
You need to create phpinfo page in your account through cPanel file manger and then try to browse that to check all php information of your server.
Here are the php code of phpinfo page.
<?php
phpinfo();
php?>

Dreamweaver CC can't connect to my local XAMPP testing server via PHP

I'm a newbie at PHP, and coding in general, however I'm attempting to set up a simple user login/registration page using a MySQL database via phpmyadmin. After hours of trawling through forums etc, I could only find outdated information with no relevance to my specific issue.
My set up is as follows:
XAMPP v3.2.2, phpMyAdmin (Apache/2.4.18 (Win32) Open SSL/1.0.2e, PHP/7.0.3 with mysqli PHP extension/ Maria DB Server Type) & Dreamweaver CC.
I have set up a new site & a new server (following various online tutorials that show the same method) but when I attempt to define a connection via recordset, it displays the error message:
"Your PHP server doesn't have the MySQL module loaded or you can't use the mysql_(p)connect functions."
I have the MySQL module loaded and it's working fine as I am able to connect to phpmyadmin. Apache module is loaded and it's working fine as I am able to connect to my localhost in the web browser. Details for testing server have been set up in C:\xampp\htdocs\mysite and changed to PHP/MySQL server model.
The database and tables have been created in phpmyadmin and ready to go, however I just can't connect to them through Dreamweaver CC.
I've tried changing information in config.inc.php, tried changing extension_dir path to mysqli.dll in php.ini (which is in C:\xampp\php\ext) and also uninstalled and reinstalled XAMPP twice.
I believe that my phpmyadmin and XAMPP server are working fine, however I just can't seem to have any success linking it to my php pages in Dreamweaver CC.
Am I missing anything obvious?
Any help/clarity would be greatly appreciated as I'm currently losing all hope! Thank you!
i know this is a little old but i was able to fix the problem.
xampp by default only has MySQLi dll activated. go to the php ini file and uncomment the MySQL dll and restart the Apache server.
this worked for me. also cs6 need the database extension installed.
The error says "Your PHP server doesn't have the MySQL module loaded or you can't use the mysql_(p)connect functions."
In php7 mysql_* has been deleted you have to use mysqli or PDO instead.
You can read more about hereenter link description here
The error shows that you are using mysql_* extension. Your code must look like these: mysql_connect("localhost", "user", "password");. You have to change this to $conn = new mysqli("localhost", "user", "password", "database");. Check this link to review how to change your

Could not be located in dynamic link library php4ts.dll

before it was working fine after installing dot net ..when i started wamp i am getting error as
The procedure entry point_object_and_properties_init could not be located in
dynamic link library php4ts.dll
When i check in
D:\wamp\bin\apache\apache2.2.22\bin
php4ts.dll is not present there. So i take a copy of php4ts.dll from
D:\wamp\bin\php \php5.3.13\ext and paste it in D:\wamp\bin\apache\apache2.2.22\bin
But still it showing same error
i changed port it worked..i changed the port in http.conf it worked...

Wordpress installation - php and mysql are not talking to each other to access database?

I'm trying to get a wordpress local install working on my Mac.
I've recently set up a database, username and password using the MySQL client as per the instructions in the wordpress codex. That part is ok.
When I go to the local site on my computer I'm prompted by wordpress to set up the wp-config.php file. Putting in the same details that definitely work with the MySQL client returns an error.
Manually updating these details in the 'wp-config-sample.php' file and renaming it as 'wp-config.php' also doesn't work - I'm now greeted with a big bold message: "Error establishing a database connection".
From what I can gather, php and mysql are not communicating with each other properly.
I've changed the apache 2 configuration file found in 'etc/apache2/httpd.conf' and uncommented the line which loads the php5 module: LoadModule php5_module libexec/apache2/libphp5.so
and restarted the apache server. This has still not fixed my problem. I'm stuck on what to do next... help appreciated please!
It's been fixed now.
php was looking in the wrong place for the mysql.sock file, and couldn't communicate with the mysql database, meaning wordpress couldn't be set up.
On the command line I typed
ps aux | grep mysql
to bring up as much info about mysql that I could. From this I saw that the mysql socket on my computer is being used at /tmp/mysql.sock
Meanwhile, in the "wp-config.php" file, I changed the line define('WP_DEBUG', false); to define('WP_DEBUG', true); and refreshed my web browser that was showing my localhost setup. This now said a lot more info than "Error establishing a database connection" - infact I could see that the mysql.sock was not configured correctly at all.
Creating a 'phpinfo.php' file with just the single line of code <?php phpinfo(); ?> was the pivotal turning point for me.
Putting that 'phpinfo.php' file in my localhost directory and then viewing it from my web browser not only definitely confirmed that the mysql.sock file was not configured properly, but it also showed where the configurations were being loaded from on my machine: '/private/etc/php.ini'
The next thing I did was open up the 'php.ini' file in a text editor and doing a quick find and replace to update the correct location of mysql.sock.
Finally, a restart of the local apache server needed to be done to fully update all the new settings that I'd been fiddling about with.
sudo apachectl restart
Now everything works fine!
The Error-Message "Error establishing a database connection" indicates clearly, that the php-script can not establish the connection. This can have one of the following reasons:
Your host in the wp-config.php is not correct.
The mysql-server does not listen on that host
The user you set up in the mysql has no privileges to connect the way you are trying
The firewall blocks the access of the php-script to your mysql-host
Try to connect the database with the same settings of your wordpress using Sequel Pro (or any other GUI to connect a mysql database). If the connection works, the problem 2. and 3. isn't your problem.
Look in your firewall-log to make sure 4. is also not your problem.
If all problems are excluded (even 1. after a final check), try to run something like phpMyAdmin to connect your database, to make sure your php-installation has the needed drivers.

Categories