Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Thursday, 13 February 2014

More On Error Reporting in php

Error Reporting
Error Reporting
This is a tutorial for Error reporting. Let’s Back to php.ini file(ScreenShot1).

More On Error Reporting in php
Screenshot1
Error Reporting value is E_All, So we are Reporting errors back to our self as we developing. What happen if i want to report errors Strict errors. Now E_Errors Does not Include E_Strict, So i will specify under error_reporting another value E_Strict (ScreenShot2).

error reporting
Screenshot2

error_reporting = E_ALL & E_STRICT


Now this will include errors of run-time notices, enable to have PHP suggest changes to your code which will ensure the best interchangeability and forward compatibility of your code. So basically giving us messages about code itself other then errors that you made be coming across  Now “&” sign is use for including and for not including “~” sign is used. (Screenshot3).

php code errors
Screenshot3

error_reporting = E_All & ~E_NOTICE 

If we don’t wanna Show E_NOTICE types of error we include “~”.This will show all errors, except for notice and coding standards warnings.So Its upto you what level errors you want to display if your codes having errors.If your application is big you can turn onhave a look. Now when u complete your program or applicationon web-server you have to turn error_reporting off
When u complete your program you need to :-

error_reporting=0;

Why the reason being is the errors shows on your pages specially in E_STRICT notices you don’t want to your users or viewers to tell about your errors notices and warnings. For security reasons also u had to turn off. For example if u including file or copying file and there u had errors its shows errors to visitors and they will understand your website structure.So, Best thing is to you put error_reporting=0 when u release your website to web-server to visitors. Now if u had paid hosting you will not have access to php.ini files for that there are some functions have look. What happen if we want to dynamically update error_reporting value inside php (Screenshot4), and (Screenshot5).

php codes error reporting
Screenshot4
error_reporting
Screenshot5
 Code Dynamically update error_reporting value inside php:-

Code Error reporting for E_ALL :-


<?php

error_reporting(0);

echo $var = 'Alex'

$var2 = 'billy';

?>




You can also use functions for writing dynamically update error_reporting value inside php

ini_set function
Code for ini_set function Screenshot6

<?php

ini_set('error_reporting',E_ALL);



echo $var = 'Alex'

$var2 = 'Billy';

?>


This is all About error_reporting how u can put errors for you how can you find errors for visitors.
Read More

Monday, 10 February 2014

Phpinfo function


phpinfo function
Phpinfo Function
The phpinfo function. We should detailed look to php installation so for example you may go later to look at GD library. Its a Image generate Images using its command-set its addition to php may not be included in original php installation. If some one ask you did you had kernel or GD images installed. You should know what its is its a Different library for php. You need to find a way to check every think in php installation and general information about php version some one must ask you or need to find out which version of php you using and different features of php version works with updated php version. Different features of php works with different versions of php. You must using older version of php and could not get some advantages of php updated features. so should check updated version. This stuff you can find out by phpinfo() function.So to call function its relatively simple Within php tags write phpinfo(); () Its a standard notation for calling function. Its a built-in function of php which is built ed in directory ofinstallations files.

Codes To Write phpinfo function :-


Code Phpinfo Function
Code PhpInfo Function
<?php
phpinfo();
?>

Output For Phpinfo Function

Phpinfo function
Output PhpInfo function Php



We can see php version 5.2.9 in output as you scroll down you will see many things enabled and all. Its a list of collection of our php installation  its having information about php core, apache , apache environmental  ftp support and many other stuff. Also gd libaray gd version and its also linked in apache. One thing you should always remember this file should not be upload on your server its available on your local machine. If you upload this file on server had change to hack your website. phpinfo file had lots of information about out php installation on our local machine from that data anyone can harm your files. If you had such file on server should delete it for security purpose.So phpinfo had an information about your php package.
Read More

Sunday, 9 February 2014

Installing Xampp Part -1

This is Php Tutorial of Tutorials JackPot. If you want to start as php developer, Then firstly you need to have a platform to test your codes. You must have already purchased your paid hosting check whether they allow php extensions or not ! 99% paid or free hosting allows you to run php on the server. Its pretty much obvious that in most cases most of the hosting companies gives this service to its customer.


Hosting
Hosting

What happens when you want to test everything locally on your computer.So firstly, create a php file and upload it to the server as above ,but we want to quickly and easily obtain its result on the local machine. So what we can do is that we can turn over our computer into a web server. Now, its highly not recommended to allow access to the web server and the files if its not properly configured, Otherwise you can have some security issues there. Let me show you a screenshot of how you can access an another portion your computer. Opening a port 80 on your computer which allow people to access everything you save into your htdoc folder. As going ahead, Ill explain you about how to create or install a mini web server on to your computer. As I am personally using “Xampp” I would advice you to download and install “Apache” as a web-server for php. Apache web-server allows you to compile in the background server, Since php is a server side language.It allows you to compile php files, run them and display the content of your programs in the browsers.

Localhost
LocalHost
So, basically you need something like xampp or wamp. I am showing you wamp so its available however i am going to be dealing with xampp and xampp by default directory things like that. So, if you are following this tutorial i am using xampp or otherwise you can take wamp and see you can get idea from this tutorial.

Xampp
Xampp
However you can also use “Wamp” for php which works on “IIS” server that can be easily installed on “Windows OS”.Working of both Xampp and Wamp are almost same,just the difference is about the folder where the file is saved.


Redirecting to Xampp, Firstly friends you need to visit Appache Friends.There you will find Xampp for Linux, Xampp for Windows, Xampp for Mac os x, Xampp for Solaris. Php can easily work on any of this operating system and its also free of cost.For support on how to install Xampp here are some screenshots.Download Xampp by clicking it on Xampp s Xampp Installation page

or
Method B : “Installation” without the installer   ( I highly recommend you to go with the installer method A.)




Read More

About Me

Welcome to Extra Tutorials! My name is Mohammed and I am the 22 year writer, website developer, and photographer behind the blog. Thanks for visiting! Tutorials Jackpot… In addition to Developer, I love to develop websites and I love to write. Starting a php Blog was inevitable for me. What began as a simple way to share all of my Tutorials with friends and family has developed into my Part time job.

Mohammed Padela

WHAT IS PHP PROGRAMMING

WHAT IS PHP PROGRAMMING
WHAT IS PHP PROGRAMMING

Follow Us

Popular Posts

Designed ByBlogger Templates