Many errors in WAMP for php on a specific PC

137 views Asked by At

I have installed WAMP server to work on php, but there are some issues. First of all, the WAMP icon doesn't turns green as i start WAMP, it remains red/orange all the time, I have tried many things but nothing worked. To be more clear, although the icon remains orange it opens localhost and phpMyAdmin in the browser, but when I try to access my php files it shows many weird errors (syntax and others). Those files run on other systems perfectly so there should be no such error on my system. Some errors are:

Notice: Undefined index: uid in C:\wamp\www\MI\accesscontrol.php on line 17

And

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\MI\rs.php on line 2

These errors don't occur on other PCs. Please suggest something to fix both icon and error issues.
Thanks!

1

There are 1 answers

0
RiggsFolly On

Any error starting with :-

Notice: Undefined index:

are errors that do exist on your other system(s) but you have configured the other server Not to show errors its how a LIVE server should be configured but not how a Development server should be configured. WAMPServer is of course a development server.

It either shows the code was developed badly, or on a live server where errors are not shown to the screen. However check the live servers php_error.log and they will be shown in there, assuming that was not also turned off.

Anyway the correct solution is to Fix the Errors while the quick and dirty solution is to tell PHP not to show these errors to the screen.

Edit php.ini (using the wampmanager menus ) and find this line

display_errors = On

and change it to

display_errors = Off

The errors starting

Deprecated:

Are showing because the code was developed in an older version of PHP and the code being used contains code that will soon be removed from PHP.

So again the correct solution would be to refactor the code to use either the MYSQLI_ or PDO extensions to get to a MySQL database. If there is not time to do this, you can stop these errors being generated with another change to the php.ini file

Find this line

error_reporting = E_ALL

and change it to

error_reporting = E_ALL & ~E_DEPRECATED

Now there is the issue of the Wampmanager icon not moving to a GREEN state.

If the wampmanager icon stays ORANGE then one of the services ( wampapache or wampmysqld) has not started correctly. As you can see localhost I would suggest that it is MYSQL that has not started. If that is the case, look at mysql log ( using wampmanager menus) or if that is empty, the "Windows Event Log" for error messages from MYSQL.

You may need to ask another question if you cannot work out a solution to that error, but a couple of things to look for are :-

  1. Have you got another MySQL running on your PC
  2. Is there a rouge my.ini in the C:/windows folder somewhere. If so delete it.