PHP Code suddenly doesn’t work?

In this article I’m going present to you the things that I did in order to make things work again. Were talking about php code in here. One that is supposed to be working and has been proven to work before. But suddenly acts strangely. And does not do its purpose. Here are some things that you have to check  if your code suddenly acts strange.

 

 

Extensions

First thing that you have to check are the extensions which are installed on your browser. Be it Chrome, Safari, IE, or Firefox. The best way to detect which extension interferes with your code is to disable all of them. Then enable them one by one while executing your code if it works or not. I identified Web Technology Notifier Chrome extension to be the culprit using this method. From now on, I’m going to disable it when I’m working with my code.

image

 

 

PHP, MySql and Apache Version

This also needs to be considered since some of the code which works on a lower version of php. Does not work on a higher version. Or vise-versa. Since the higher versions of php deprecates some of the code which are used in the lower version. For security and performance issues to be resolved. That’s why its always smart to note what Php, Mysql, Apache version you are working on. Php version is easily identified. Just identify which version is checked in the Wampserver tray icon. In this case version 5.3.0. Do the same with the Mysql and Apache to know the version which you’re currently using.

image

I have made a guide on how to use different php versions on your Wampserver installation. You could use this to change the php version to the one that you have used when you have created the project. So that all the codes that you used would be compatible with the php version that you are running.

 

Database

Sometimes the database can also be the problem. Especially if its not well-normalized. What I do is to reset the database by using a table truncating code. Which will empty all the contents of the tables in the database. I have previously made a tutorial on how to truncate tables in your database. Note that truncating is different from dropping. Dropping drops the whole table together with the data that is stored. Truncating just empties the data which is stored in the table.

 

 

Browser

Might also be the culprit. So try to identify which browser you are testing your projects. Also note the version of the browser.  In Chrome you can check the browser version by clicking on the wrench icon and select About Google Chrome.

image

If you’re using Firefox or any other browser then do me a favor and just consult Google.

 

 

Operating System

This could be the weirdest part. But I guess its worth checking as well.

 

Application Ports

It could also be that some of the ports which are used by Mysql and Apache is actually being used by another application as well. I made a guide on how to change the port that Mysql uses. Be sure to check it out.

 

 

Conclusion

If after checking all of these stuff. And your code still doesn’t work. The possible conclusion with be that someone actually modified your code in one way or another. Or maybe you have accidentally modified it while you were sleeping. That’s why its always nice to keep backups of the codes which are tested to be working so that you won’t have to make those all over again and waste time in case you have difficulty making it work again.

If this tutorial helped you. I’d appreciate it if you would share it to the world. By using the buttons below. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s