How to set up smartphones and PCs. Informational portal
  • home
  • Iron
  • How to start learning PHP? Learning to program in php from scratch.

How to start learning PHP? Learning to program in php from scratch.

Reg.ru: domains and hosting

The largest registrar and hosting provider in Russia.

Over 2 million domain names in service.

Promotion, mail for domain, solutions for business.

More than 700 thousand customers around the world have already made their choice.

*Mouseover to pause scrolling.

Back forward

20 Ways to Learn PHP and Save Kittens

There is an old saying going back to the early 1700s. It says, "Every time a PHP programmer doesn't follow coding best practices, one kitten dies."

Okay, let it be a joke, but let's be what we start from.

Getting started with PHP can be a tricky experience. With that in mind, 20 good tips will teach you how to follow best practices and save lives... kittens' lives.


0. Code as often as you can.

Did you study a foreign language at school? Did you learn all parts of speech, verbs and how to conjugate them, while constantly listening to the teacher's speech, built from the simplest phrases and constructions?

How much of the knowledge gained at that time do you really use?

"Frequent programming with a specific purpose will lead to a solid learning experience."

If your answer is "no", then I'm willing to bet it's because you haven't really used the language - you've only learned it. But if you're still able to carry on a conversation, it's probably because you've been speaking that language for a while outside of the learning context. Perhaps you spent some time abroad or worked in a place where knowledge of this language is needed?

Whatever the reason, you kept it only because you used it in real life situations, in a personal context, which makes it easy to recall the main points in the future.

"PHP is an unfamiliar language, like Spanish or French. To feel comfortable with it, you need to practice it outside of the "classroom".

Tutorials and example projects are all great for learning the basics, but until you start applying the knowledge to your own projects, it won't settle down in your head very well.

So don't worry if you don't "know everything you need" before starting the project. When you have decided on a project, you have a good reason to learn everything you need and put it into practice. Frequent programming with a specific goal will lead to a solid absorption of knowledge.


1. Check out the PHP documentation

For some reason, every list of useful tips contains this item. And definitely not in vain.

Learning to navigate the PHP documentation is the most useful thing you can do for yourself as a web programmer.

If you look at the history of sites in my browser, the PHP manual is the most visited. And I suspect that the situation will not change as long as I program in PHP.

At first, the manual looks a bit complicated and the navigation feels a bit clunky, but this is temporary and you'll find it very easy to navigate very soon.

Perhaps one of the useful knowledge about the manual is that most of the features can be found using the template http://php.net/function-name in the address bar. For example, to find a function strpos() use the address http://php.net/strpos, and for array_key_exists() - http://php.net/array-key-exists. Note the absence of parentheses in the address and the change of the underscore to a hyphen character.


1a. Read the comments!

It's easy to overlook the comments, but do yourself a favor and study them. If, as a result of some function, you get an unexpected result, then, quite possibly, someone noticed this and explained what was what in the comments.

In addition, by reading other people's comments, you can get a lot of useful ideas from other developers.


2. Take Advantage of the Huge PHP Community

In addition to the PHP manual, there are many other great developer communities around the web. Among my favorites: stackoverflow.com and forum W3Schools.com.

Also, Twitter is a surprisingly great place to post questions about PHP. If you tag a tweet with "PHP", chances are someone in the community will notice and lend a helping hand.

"It's important to remember that once you get better at PHP, pay back. In order for the community to live, you need as many active people as possible. Try to answer questions from other newbies. Don't be deaf to other people's questions."


3. Don't put off good practice

As you learn, you'll probably hear about good coding habits and standards, like prepared expressions and standards from PEAR. Don't put off learning these things "until later" just because they seem complicated.

"If something is good practice, it's not because we (other PHP programmers) got together and said, 'How can we make life difficult for newbies?'

Good practices exist to make your scripts more flexible, safer, and faster. Learn them as quickly as you can. In fact, you should not even start learning in the wrong way.

The time you spend studying mysql_query() comparable to study time PDO or MySQLi. Therefore, if you start right away with the second option, you can be sure that you start with the fundamentals of working with a database and, ultimately, spend less effort and time on it.


4. Don't put off good practices for later!

I just wanted to make sure you took note of this.

"Seriously guys. Don't procrastinate. Every time you break best practices because they seem 'too complicated', BP is drowning another fluffy kitten in crude oil."

So unless you're doing this for yourself, your projects, your colleagues, or the community in general, at least keep the kittens in mind.


5. Make your code self-documenting

In the early stages, of course, it can be tempting to "play around" with variable and function names. Maybe you've read articles about performance or seen a code snippet that does a ton of work in just two lines of code (but sooooo long :)) or you want to create your own "brand" coding?

"If you want to survive all characters from variable names to reduce the overall script execution time by 0.2ms, then you are likely to run into big problems."

Whatever the temptation, you must resist at all costs.

Consider the following code snippet:

Do you understand right off the bat what's going on here?

Of course, you will figure out how it works, but why make other people who study your code spend an extra minute trying to figure out what the variable with the "speaking" name "c" contains?

Let's take this code and make it self-documenting:

That's it. Much better. Now, just by looking at the code, you can get a general idea of ​​what's going on. No rubbing foreheads and mumbling curses and, most importantly, no difference.

Of course, you can win a few bytes by using short variable names. But, frankly, if you want to survive all characters from variable names to reduce the total script execution time by 0.2 ms, then you will most likely run into big problems.


6. Add comments to everything you have to think about

Comments are not a hallmark of newcomers. Rather, on the contrary, studying a large amount of someone else's code, I come to the conclusion that comments are a sign of a competent web programmer.

If your code is self-documenting, then you won't need many comments. However, no matter how obvious and understandable the names of your functions and variables may be, there will always be some "white spots" when the perfect action on is completely obvious.

"Comments are the mark of a competent web programmer."

When this happens, comment out the code. "Future You" say "Current You" thank you so much when it's time to modify the script.

"As a rule, if you think for a few seconds about what needs to be done in order for the script to work as it should, this is a sure sign that it is worth taking a note."

Let's see:

$pieces = explode(".", $image_name); $extension = array_pop($pieces);

What's going on here? Did you have to stop and think about the code? You are still not sure what is in the variable $extension?

Look at the snippet below again, with just one brief comment:

// Get image file extensions $pieces = explode(".", $image_name); $extension = array_pop($pieces);

Now, even if you do not know exactly how some code works, you will at least know what is in the variable $extension is the image extension. If it helps Future You, or saves a few seconds of another developer's time, then it makes sense to spend 7 seconds to add a comment.

As always, moderation is key.

Too few comments and you run the risk of leaving another developer (and "The Future of You") confused about certain code snippets. This can even lead to accidental code breaking, as if there is no explanation, then the code may seem silly or redundant.

"Moderation is the key to everything."

Too many comments - and your code becomes difficult to "scan", which also greatly hinders the work.


7. Learn Docblock and use it

Docblock is the commenting standard (more info).

I have several reasons for using this standard:

1. It makes us think about the "what" and "why" for each file, function, method, etc.

2. It gives clear descriptions of expected parameters and return values ​​for functions/methods.

3. It gives a brief description of what this or that code does.

4. In combination with a development environment (IDE) that supports Dockblock, we have code hints (which allow us to see the descriptions, expected parameters, and return values ​​for the functions and methods we use).

This point can be called a limitation for "high-level beginners", but I attribute it to the best practices that need to be mastered as soon as possible.

Feel free to skip this step, but keep kittens in mind.

Docblock shows its versatility when used to document classes:

/** * A simple class to calculate the sum or difference of $_foo and some value * * @author Jason Lengstorf * @copyright 2011 Copter Labs * @license http://www.opensource.org/licenses/mit-license.html */ class CopterLabs_Test ( /** * Value used for addition and subtraction * @var int */ private $ _foo = 0; /** * Add value to $_foo and return sum * @param int $add_me Value to add to $_foo * @return int Sum of $_foo and $add_me */ public function add_to_foo($add_me=0) ( return $this->_foo += $add_me; ) /** * Subtract a value from $_foo and return the difference * @param int $subtract_me The value to subtract from $_foo * @return int The difference between $_foo and $subtract_me */ public function subtract_from_foo($subtract_me=0) ( return $this->_foo -= $subtract_me; ) )

At first glance, this may seem depressing, but the benefits are well worth taking the time to become familiar with this syntax.

The above Docblock when used in Netbeans will give us code hints like this:


8. Don't be such a hardcore coder that you don't want an IDE

If you don't already know, then there is this belief: hard coders who think like real programmers don't use IDEs.

Now look, if you want to impress people, you better learn how to juggle.

Refusing to use anything other than Emacs on the command line for scripting won't get you girls or instant bad hacker status, but it will cause your colleagues to put a warning on your forehead that you "Strange guy".

Don't be "weird guy".

"There's nothing wrong with using software that gives you on-the-fly syntax highlighting, error checking, and code hints."

How powerful an IDE to use is entirely up to you. Personally, I really like Netbeans. I've heard tons of praise for Coda for Mac (although it's not really an IDE), and I used to use Eclipse myself (before moving to Netbeans).

Regardless of which IDE you use, you will see a speed increase and a reduction in minor bugs. Later, when your code libraries grow, you'll have code hints for all your applications (because you're using Docblock, right? Right?!)

Don't think IDEs aren't cool - no matter what "Weird Guy" tells you.


9. Group repetitive code into functions

When you first start writing an application, you can easily work from top to bottom and add the necessary code in the right places.

However, when you do this, you will very soon notice that certain parts of the code appear over and over again. This approach becomes a minefield when it comes to maintenance and changes. After all, in this case, you have to look through each file to and from in order to find all occurrences of the same type of code pieces to change the functionality of the application.

If you see that the action is repeated, at least even twice, then you should seriously be puzzled by the question of moving this code into a function.

Consider the following example:

$unclean1 = "Click Me!"; $detagged1 = strip_tags($unclean1); $deslashed1 = stripslashes($detagged1); $clean1 = htmlentities($deslashed1, ENT_QUOTES, "UTF-8"); $unclean2 = "Let"s call Bjorn!"; $detagged2 = strip_tags($unclean2); $deslashed2 = stripslashes($detagged2); $clean2 = htmlentities($deslashed2, ENT_QUOTES, "UTF-8"); echo $clean1 , "
", $clean2;

As you can see, both strings need some processing before they can be considered safe. In doing so, you also see that the same functions are used for processing both times.

This is the case when using a function is much more desirable:

$unclean1 = "Click Me!"; $unclean2 = "Let"s call Bjorn!"; $clean1 = sanitize_input($unclean1); $clean2 = sanitize_input($unclean2); echo $clean1, "
", $clean2; function sanitize_input($input) ( $detagged = strip_tags($input); $deslashed = stripslashes($detagged); return htmlentities($deslashed, ENT_QUOTES, "UTF-8"); )

Once you've put repetitive code into a function, it's much easier to navigate and edit the steps you take to clean up the input.


10. Group similar functions into classes

Familiarity with OOP (object-oriented programming) is another point that can be categorized as "learn as early as possible".

"If you have a set of functions that work with, say, a database, you can save a lot of time and effort by grouping them into classes."

Learning is definitely beyond the scope of this article, but I think it's important to mention it as part of this list for beginners.


11. Use constants, not global variables.

When I first started developing large projects, I found myself using global variables much more often than necessary. Recognizing this problem is the first step towards solving it.

I stored immutable data (like the site name and the maximum image width) as well as the credentials to connect to the database in variables, which led to the fact that I had to use an array $GLOBALS to access the required information.

Then I realized that PHP allows you to define constants using the function define().

A constant is a great way to store information that doesn't change for the duration of an application. An added bonus is that the constants can't be changed, so you can't accidentally overwrite the database password while the script is running.

In terms of good practice, the widespread use of global variables is not encouraged at the initial stages of work, so it is always better to start with the use of constants. Look at this code to evaluate everything yourself:

\n" . $global; ) ?>

12. Don't be afraid to use Includes

Almost always, when you create large projects, it makes sense to break them into smaller chunks using include files.

A typical approach among web developers is to put each completed piece of code used in many scripts into a separate include file (for example, database connection data, footer and header, which are usually identical for the entire site , various service functions, such as the function of checking incoming data, etc.).

This way you can connect the necessary code in the right places in one line instead of copying and pasting the same piece of code.

For example, on a site with many pages, a typical template might look something like:


13. Don't Go Crazy About Performance

This is a serious stumbling block for some developers, which is not good. There is a very fine line between writing efficient code and wasting time trying to reduce script execution time by 5ms.

It's definitely worth reading some good performance articles and learning about the major bugs you're dragging from application to application, but it's not worth spending a lot of time carefully refactoring your code to change double quotes to single quotes because you've learned that it will be a little faster.

"Use your head to avoid big problems and keep your ears open when you hear about application acceleration techniques, but don't make it a performance race."

No one will be able to notice the difference when loading a page in 25 or 40 ms. Make sure it's not 700ms. and get on with more important things.


14. Don't "marry" HTML to your scripts.

This may require a lot of ingenuity from you, but try to avoid injecting markup all over the PHP code. It's almost impossible to completely remove it from PHP files, but make sure you do your best to avoid including non-essential HTML markup in your code.

Consider the following example:

echo"

Here comes the content.

";

Is it really necessary to wrap a paragraph with a tag? div? Is it possible to change the code so that it only includes paragraph tags for text content? Let's look at an alternative:

Here comes the content.

"; ?>

Note: This example is greatly simplified. The main idea is to resist the temptation to put much more markup in the PHP file than is necessary.

In most cases, you can separate HTML from PHP, which will make your scripts easier to read and maintain.


15. Try to use at least one unfamiliar concept in every new project.

You will never learn something new if you keep doing the same things. When developing each new project, use at least one new technology, one new technique that is unusual for you.

It's not about being overly ambitious - just deliberately pushing yourself outside of your comfort zone.

For you, this will be a competition that will not let you get bored from repeating the same actions and will contribute to your development as a web developer.


16. Don't be too proud to change.

You will be wrong. And often. But it's not that bad.

As you grow, you find new, better solutions to problems you've faced before. Don't feel like a fool: you are constantly learning new things.

It is very important here not to get attached to the code you have written. Don't think your code is better just because you wrote it. If you come across a cool solution to a problem, use it! Pay attention to what others have done and what you can improve on your own.

"Never allow yourself to think that an unprofessional decision is acceptable because it is yours. This is arrogance (which usually does not lead to anything good)."


17. Validate

If you are a web programmer, start learning input validation as early as possible.

Remember: Validation is not the same as sanitization.

"Validation of incoming data is a check of the fact that this data corresponds to a certain format, such as checking whether the entered value is a valid email address, or whether the login field contains from 8 to 20 Latin characters or numbers."

This can be tedious and tricky, but if you make sure that only the right format data is fed into the script for further processing, you will greatly improve the "quality of service" for your site visitors and avoid a lot of errors in your scripts that use this data.


18. What is not forbidden is allowed?

In many situations, you need to get rid of certain characters, pieces of text, tags, and so on.

A typical solution is to create a so-called "blacklist": a collection of prohibited tags, symbols, etc.

"If you don't constantly replenish and monitor your blacklist, then this is fraught with vulnerabilities."

This, however, creates additional difficulties. You need to be smarter than those who want to do something "illegal". For example, to disable JavaScript in comments, you could disable the use of the OnClick event and the like, but what if you missed something? What if some new events are added to the specification in the future?

If you do not constantly replenish and monitor your blacklist, then this is fraught with vulnerabilities.

Therefore, to save yourself a headache in the future, if possible, use the white list. A whitelist is the opposite of a "blacklist": a collection of toegs, symbols, etc. that are allowed to be used.

For example, in the function strip_tags(), you can explicitly specify which tags are allowed on strings:

Strip_tags($string, " ");

Now your problem will most likely be that you did less than you wanted :) However, this approach is much safer and will provoke less unpleasant situations in the future.

Of course, it's not possible to use this approach everywhere, but by specifying what is allowed instead of what is not allowed, you gain more peace of mind and more control over your scripts.


Are you looking for 20 way? Remember that in PHP almost always and everywhere the countdown starts from zero, so this is the 20th way. You will notice that this is the case in almost all languages, so don't be fooled!


Summarizing

If you are a beginner, the tips discussed above will help you make significant progress towards implementing good practices in your business.

Do not be alarmed if everything that is written here is new to you: just take one step at a time (see paragraph 15).

From the author: On the World Wide Web, physical strength means nothing! You can press the keys with any force, but the result will not change. On the Internet, the one with more experience and knowledge is considered stronger. Although my friend “pumped up” the hardware of his PC so much that he became afraid of it! But this is with everything from the "iron" opera. And today we will find out in PHP where to start learning to become a strong programmer.

"Tea" disease

Of course, sorry, but you are a "teapot". How did I guess? Well, because only beginners ask themselves such questions. And there is nothing offensive in this “title”, because you have so much desire for learning that you can “boil”. And this is a sign that everything will work out!

The study of PHP, like any other science, should be started from the very beginning, that is, from the theory. You need to understand what this programming language is: its capabilities, main scope, features, and so on. This is an important aspect, since beginners, due to the lack of basic theory, general ideas about a particular language, often make the wrong choice. And after that, with deceived expectations, they quit training after several hours of “research”. I will try to lift this veil a little so that you understand not only where to start learning PHP, but also why.

A few features of the language that beginners should know:

Most often, PHP is used in website building, but it can also be used to develop client applications.

It is a server-side language - its code is executed on the server side, so you will need a local server or an appropriate assembly to learn.

Close relationship with - if you are going to “storm” site building, you will also have to learn the specified DBMS. We will help you with this.

Where is the beginning?

If you are going to learn PHP programming, but don’t know where to start, then this section is for you. You should start with the basics: with the syntax of the language, data types, variables, their initialization, loops, function declarations, etc. Even if you studied all this in other software disciplines, you will have to read it again, since PHP has a number of features.

But it will be later, but initially you need to decide on the main literature for comprehending software science. The choice of sources should be approached very seriously.

Choose a few, and read a couple of pages from each. The presentation style of the main source should be as simple and clear as possible. The success of education as a whole depends on this.

To comprehend PHP, you can use various tutorials, specialized manuals for "dummies". It would be nice to add one or more sensible ones here: the visualization of information significantly increases the assimilation of the material. But once again I repeat: where to start learning PHP and the choice of sources is up to you.

A little personal

In general, after the first semester, in terms of academic performance, I slipped to the very bottom. And all because the teachers, seeing that most of the students "swallow" all the material, even "not chewed", tried to give as much as possible. But I did not have the experience that my groupmates had.

The next semester, I transferred to a parallel group consisting of the same “dummies”. For them, the teachers “bited” and “chewed” everything, carefully explained. Here things went "on the mend", and I again became one of the best students.

I am not boasting (well, maybe a little), but I am trying to explain that you should choose the style of learning, methods of obtaining information and the duration of comprehending the discipline for yourself. In my opinion, various are an ideal source of educational information. Their selection is what you need to start learning PHP from scratch.

What you need to start development

PHP is a programming language whose code is executed on the server side. Therefore, to work with it locally, you need the appropriate software. Three main components:

PHP interpreter.

local server.

But installing each of these components can take a lot of time and effort. Especially if you are a beginner. The best option is to install a software package that includes all the components.

I recommend using Open Server. It includes everything you need to get started with PHP without much headache. The installation process is automatic (easy and fast). Just what you need for real "dummies".

I hope I managed to dispel all the doubts and questions that "haunt" newcomers. Do you feel like you've gotten stronger? You are just getting started with PHP. Soon you will be real "strongmen" in the software sciences. See you for new workouts!

During this course, you will learn the basics of the PHP language and explore the possibilities of this language. This interactive PHP course is designed for beginners and contains detailed text and video instructions - choose what you like best.

In the course, everything is studied in great detail - learning begins with how PHP works in general. It tells about modern tools and approaches. And, of course, homework is given, which I personally check. Here we will install a local web server, and learn how to work in a code editor, and, of course, write our first programs in PHP.

This course will allow you to master the basic principles in writing code, which no future developer can do without. Here you will get the necessary foundation that will allow you to go further, learning more interesting and complex topics in programming.

Course program

Level 1. Introduction to the PHP course for beginners

Level 2. Setting up the environment

Level 3. Development basics

Level 4. Loops and arrays

Level 5. User interaction

Level 6. Working with files

Level 7

Level 8. Conclusion

Why PHP is needed for a beginner developer

Knowledge of HTML allows you to get an idea of ​​how to create websites. And even gives you the opportunity to independently develop Internet resources. However, the use of this markup language is limited due to the static nature of the pages created with it. In particular, it is used in most cases for the development of business card sites. The thing is that if you need to make any changes, you need to edit each page separately, and if the resource has several tens or hundreds of them, such a process will not only be tedious, but also stretched out in time.

The use of the PHP language (acronym: Hypertext Preprocessor "hypertext preprocessor") allows you to optimize site administration - a scripting programming language that allows you to create dynamically filled web pages. Its use makes it possible to make the resource truly interactive, and the process of managing the site - simple and less costly in terms of effort. Online PHP lessons for beginners from WebShake help you master the basics of a scripting language from scratch, learn how to create dynamic resources that are easy to modify and maintain.

Our online PHP video and text lessons are designed to be understandable to every user who wants to learn web development. And homework, placed at the end of each topic, will allow you to consolidate the knowledge gained and hone their application in practice.

Benefits of the PHP Language

Our interactive PHP course is distinguished primarily by its practical focus. The rich functionality of the PHP language for beginners allows you to effectively solve a wide range of tasks. And ease of use makes it possible to do it quickly and with a minimum of effort. Our free online PHP course for beginners helps you master this scripting language, which is by far the most in demand and is used to create a huge number of Internet resources (including popular social networks and blogs).

The traditional nature of PHP (due to borrowing a number of constructs from C and Perl and combining the advantages of these languages), along with the intuitive accessibility and universality of the syntax, makes the learning process easy (especially for people familiar with the basics of writing code). If, however, some difficulties arise in the process of familiarizing yourself with the course, I am ready to answer any questions that you can ask in the comments to PHP lessons online.

The high speed of script execution increases the efficiency and relevance of the PHP language, and the ability to integrate with other languages ​​(in particular, HTML, JavaScript) allows you to customize the Hypertext Preprocessor to the needs of a particular web developer.

PHP features

Website development using this scripting language allows you to:

  • Reduce the resource requirements of the web page. The web application takes up less space, becomes “lighter”, which means it opens faster.
  • Significantly simplify the process of managing a web page, making changes. Static sites do not meet the realities of today, as they simply do not keep up with what is happening around. The inability to keep up with the times ultimately affects attendance.
  • Provide an effective analysis of the site (keep traffic statistics, etc.).

The efficiency of Hypertext Preprocessor is appreciated by the largest companies. Our PHP Fundamentals for Beginners online course allows you to gain the necessary skills and knowledge to build a successful career in web development without being distracted from work or study.

Interactive approach


The method of presenting the studied material also plays an important role. For example, a dry technical text, no matter how useful it may be, is very difficult to understand. That is why, along with it, it is necessary to use multimedia files, and in particular video materials. Videos with live people involve several senses at once (hearing and vision), and also allow you to repeat in practice what has just been shown on the screen.

An interactive approach helps to make the learning process more interesting and fruitful. Along with this, web development courses include illustrations and helpful tips, as well as practical exercises and PHP lessons for beginners. All this ensures a systematic flow of material, making it much easier for beginners to navigate HTML and PHP.

Free training courses are also good because they allow you to try your hand and understand the craving for programming. In addition, this approach helps to determine the language, which is extremely important for obtaining a new specialty.


For those who want to learn PHP, you can advise the excellent "PHP Tutorial" from the site PHP5.RU
The course is in the process of being written, but now links to individual lessons from it are in various sections of this FAQ. And believe me - it's worth it.
I can't help but recommend the wonderful material by Vadim Tkachenko AKA Bizon "Introduction to PHP and MySQL" . It was even published as a separate book, and now - corrected and supplemented - is posted on the website
"PHP in detail". This resource stands alone. Unlike the previous ones, only a sadist can recommend reading it in its entirety - there is too much information there. but therein lies its charm. This is an inexhaustible resource of PHP information. The only remark - pay attention to the date of writing the article. You should not particularly trust those that were written before 2003.
Well, and, of course - this site, http: // site
If you haven't read it in its entirety, be sure to do so. Here are the problems that EVERYONE who writes PHP will face sooner or later.

Software.
To work with PHP under Windows, you need to install the following programs:
- Apache web server (5Mb)
- PHP itself (10Mb)
- optional - MySQL (23Mb).
The setup is very simple. Apache is installed by the installer. Where it asks for your server name and administrator email, you need to write localhost and your e-mail 2 times.
PHP is unpacked from the zip to any directory of your choice (by default - C:\PHP) and configured as an Apache module. To do this, you need to perform three steps:
- rewrite the php5ts.dll file to the WINDOWS directory
- in the httpd.conf file (C:\Program Files\Apache Group\Apache\conf\httpd.conf), at the very bottom, add two lines
LoadModule php5_module c:/php/php5apache2_2.dll
AddType application/x-httpd-php .php .phtml

- restart Apache (using the Apache monitor utility in the tray)
After completing all these steps, you can put a test php script (let's say it is called test.php and consists of the line

to the directory that is the root of the web server (by default it is C:\Program Files\Apache Group\Apache\htdocs\) and access it by writing the address in the browser
http://127.0.0.1/test.php

When installing MySQL, select Standard configuration, on the next screen click Next, on the next screen set a password or uncheck "Modify security settings" if you want to leave it blank.
To check, run the Mysql console: Start - Run and copy into the line that appears
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe"
or
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe" -uroot -pPASSWORD
if the console is started - everything works. Type exit to exit and start configuring PHP's mysql support.
To do this, if you have not done this before, take the c:\php\php.ini-development file and copy it under the name php.ini to the windows directory. Then edit it by removing the semicolon at the beginning of the line
;extension=php_mysql.dll
and editing the extension_dir parameter:
extension_dir = "c:\php\ext\"
can be fixed at the same time
short_open_tag = On
so that old scripts and convenient templates work
and do not forget to restart Apache after that, as described above.
Now you can use mysql in your php scripts.

Those for whom this instruction is too complicated can try to install a ready-made Denver-2 kit.
It includes everything you need at once, and a lot more unnecessary. And most importantly - everything works by itself.
Another advantage of Denver is that the volume of the basic set is 10 times smaller than the full versions - only 4 megabytes. And also the fact that its author writes interesting books on PHP.

Also, all inquisitive people are recommended a VERY sensible article Installing and configuring Apache + PHP
from the site PHP5.RU. And, of course, the sections of the official documentation devoted to installing the corresponding programs.

Forums.
When studying any case, there are bound to be questions.
Questions are easy to ask on the forums.
http://phpclub.ru/talk/forumdisplay.php?s=&forumid=12
PHPclub forum. The most visited and famous. Unfortunately, fame does him a disservice. Very often, a newbie question is answered by an even greener newbie, giving a completely wrong answer. However, there are also plenty of professionals there, ready to explain the mistakes to both the first and second.

PHP is also represented in the Russian segment of Livejournal
In communities Unfortunately, even though they did not shine with the quality of the material, they have long been abandoned by their authors and have finally lost their relevance.
Everything that is best about PHP is listed at the top of the page.
If you know a good site - write about it in the "Feedback" section.

Good day, dear readers of my blog. Somewhere I heard that every person in his life must go through writing poetry. The situation is changing and now every second person thinks about writing code and creating their own website. Many merge at the moment, others cannot decide on the engine in any way. If you finish reading this article and move on to learning according to my recommendations, I am almost sure that you will succeed.

The topic is quite complex. Today we will talk about how to write a website in php from scratch. Let's take a closer look at what these cherished three letters mean and you will learn about the best ways to not only learn, but also really understand PHP.

What is PHP?

It's a little strange to start this article with this question, because it is assumed that you already know everything and therefore are ready for difficulties. But, my blog is for beginners. Be indulgent, let's repeat the information.

In simple and accessible terms, php is a programming language specifically designed to script a web application that runs on a web server. This is a fairly popular programming language, as 85% of websites use it.

The peculiarity of this language is that it is universal, easy to learn and opens up your opportunities not only as a programmer, but also as a businessman. As a result, you will be able to write and develop your projects on your own. Without anyone's help.

We study effectively

Many began to learn this language, but few reach the end. For effective learning, the first thing you need to do is find a source of information, a book, a tutorial or a video, but more on that later.

Then we need to download the compiler. This is a program that reads your script line by line as a statement and executes it.

The most common compiler is denver, a simple and free package of necessary programs with which you can write scripts. If you ask my opinion, then I would advise you to download Open Server. He's gaining momentum now. It is a head taller than Denver and will be more comfortable for you to work in.

What do these packages do? They allow and work on it as on a server. It is not necessary to download anything right now. You will hear more than once about useful software from this series in any training course, but you will need it.

The essence of effective learning is that after going through the lesson, you should try to put everything into practice. If theory is supported by practice, then in a few weeks you will have a basic language skill.

Books for learning

Let me tell you, I am not a fan of books. When it comes to internet technology. It's like explaining to a Masai man what wi-fi is. No drawings will help to understand everything normally. Nevertheless, I want to provide you with a small list of php books for dummies that are listed among professionals.

I would like you to really achieve your goal and if it seems to you that this training option will suit you better, I will be happy to provide information.

PHP and MySQL. Web application development This is a great book for a beginner. First of all, the author will show how to set up Apache (HTTP server), PHP and MySQL (database), then he will tell you how to choose a code editor. The book covers: the syntax of the language, the most useful functions, creating your own engine and a number of other functions.


In general, nothing surprising is not it? But nevertheless, it is a real textbook with unique information that you will not find anywhere else. This is the fifth edition, so there will be no outdated information. The book was released in 2015. In order to start to get acquainted with the code yourself - that's it.

HTML, JavaScript, PHP and MySQL. Webmaster's Gentleman's Set - This is a more detailed tutorial on learning php. It touches on several other useful ones, without which the full creation of web applications is impossible.

Easy to read, suitable for self-study and student learning. The author touches on such topics as: PHP basics, dynamic page generation with CSS (cascading style sheet), database administration, creating dynamic pages with JavaScript.


Build dynamic websites with PHP, MySQL, JavaScript, CSS and HTML5 - I would recommend this book to more advanced readers who already have basic HTML layout skills. If you have ever studied this and still remember the basic principles then this book is for you.


PHP and MySQL. From beginner to professional - and the book of Kevin Jank completes our review, in which the author makes a strong bias towards creating web applications with a database.


The book is very easy to read and is perfect for self-study.

YouTube video

From my own experience, I will say that learning php from YouTube videos is quite difficult. Even though they seem simple. Unlike the Photoshop tutorials that I love, learning programming languages ​​on YouTube is simply impossible. Even a video that is only 15-20 minutes long causes a lot of inconvenience.

Such videos can discourage you from typing the code yourself. Why, if the author has already done everything for you: typed, launched, showed with a specific example how everything works? As a result, remembering something is almost impossible.

Tutorial

In my opinion, this is the perfect learning experience. It's great to have an expert with you.

Each lesson is accompanied by comments, you can ask questions to experts, calmly discuss and solve incomprehensible points. You don't have to surf the internet looking for information. Everything will be chewed and put in the mouth, all that remains is to use it.

You will be given a task and will be monitored to see how well you perform it.

I can recommend you course on netology . This training center is valued among professionals, and in just two months you can learn everything you need. Sets in the group occur constantly.

Don't worry if you don't understand something. That's what the course is designed for you to learn. This is a real step-by-step guide for beginners. Don't believe? Download the full course program from the official website and you will see for yourself.


If you dream of learning how to create sites without, on your own and in php, then this is the best option for you.

Top Related Articles