🔒 Locked
[web] Site using PHP, mySQL & Apache
Advertisement
Original Post
There's a possibility I might get some work on a part-built site using these technologies. I have a lot more experience with ASP than PHP but as a C++ programmer the language shouldn't present too many problems I hope. MySQL I've not used but I have worked with MSAccess and Oracle - once you have a database conection the vast majority of database stuff will be straight SQL so the database software shouldn't matter much to me as a developer. Apache is the real question - what actually is it? Something you develop with or just a service that runs bits of the website? Do you need to know anything about it to work on a site which has/uses Apache? Comments/Advice most welcome. Also if anyone could suggest good PHP resources online so I can brush up a bit before looking at the existing code...? EDIT: I had a link to a more web-orientated forum but can't find it. I'm sure it had 'code' in its name - any ideas for that or other good web-forums?
Have you looked at the Forum FAQ for PHP resources?
Apache is the program that serves the output from a file (html) or a script (PHP, Perl) from the server to the browser. Technically you don't need to know anything about Apache to get a site up and running but as with anything, it really helps if you do :)
The most important bits would be to look at how the httpd.conf file is setup, or how you can override the standard configuration on a directory-level with .htaccess files. Learn the simple configurations that you may need (things like DirectoryIndex) and have a look into access restrictions and setting passwords.
For PHP information: I really only use php.net. There's ten times more usefull information in the comments that go along the documentation than in any tutorial page. Ofcourse, it does require you to know what you are looking for :)
The most important bits would be to look at how the httpd.conf file is setup, or how you can override the standard configuration on a directory-level with .htaccess files. Learn the simple configurations that you may need (things like DirectoryIndex) and have a look into access restrictions and setting passwords.
For PHP information: I really only use php.net. There's ten times more usefull information in the comments that go along the documentation than in any tutorial page. Ofcourse, it does require you to know what you are looking for :)
if the server is already set up with php and everything, then nah, you don't really need to know anything about Apache... It's just the webserver. As long as it works, all's well. If it doesn't, just look up a tutorial on setting up PHP, MySQL and Apache... There are plenty covering that combo... :)
But when you request a page from a website, apache receives the request and checks whether it should just give you the page straight away (as with html), or run it through some program and send you the result (as with php). In other words, it doesn't really matter when you're developing.
As for PHP, I'd say look at their manual. It's really good, with lots of documentation, a small tutorial and lots of code examples.
But it shouldn't take you much more than 10 minutes to learn... :)
If you already know C/C++, I'd say you can probably read PHP code without any trouble, although writing it might require you to spend those 10 minutes learning the basics. ;)
And you're right, MySQL is no problem. It's just SQL, although depending on the version you use, there might be some really useful features missing.
But when you request a page from a website, apache receives the request and checks whether it should just give you the page straight away (as with html), or run it through some program and send you the result (as with php). In other words, it doesn't really matter when you're developing.
As for PHP, I'd say look at their manual. It's really good, with lots of documentation, a small tutorial and lots of code examples.
But it shouldn't take you much more than 10 minutes to learn... :)
If you already know C/C++, I'd say you can probably read PHP code without any trouble, although writing it might require you to spend those 10 minutes learning the basics. ;)
And you're right, MySQL is no problem. It's just SQL, although depending on the version you use, there might be some really useful features missing.
You can do some reasonably funky things with Apache even though it doesn't actually run the PHP pages itself (rather, it executes a PHP handler in the same process to do that)
Apache is a lot more flexible than some other web servers out there. Of particular note, is its decentralised configuration system (aka ".htaccess" files).
This enables you to keep the relevant configuration close to the files they affect (and in source code control etc).
Some things which will be of note:
- Restricting access to directories/ files either completely or by IP address
- Adding / changing MIME rules
- Getting files other than .php to run as PHP pages
- rewriting (If you're really keen)
But basically it will allow you to structure the URLs how you want which is pretty good.
Mark
Apache is a lot more flexible than some other web servers out there. Of particular note, is its decentralised configuration system (aka ".htaccess" files).
This enables you to keep the relevant configuration close to the files they affect (and in source code control etc).
Some things which will be of note:
- Restricting access to directories/ files either completely or by IP address
- Adding / changing MIME rules
- Getting files other than .php to run as PHP pages
- rewriting (If you're really keen)
But basically it will allow you to structure the URLs how you want which is pretty good.
Mark
Quote:
Original post by markr
You can do some reasonably funky things with Apache even though it doesn't actually run the PHP pages itself (rather, it executes a PHP handler in the same process to do that)
Apache is a lot more flexible than some other web servers out there. Of particular note, is its decentralised configuration system (aka ".htaccess" files).
This enables you to keep the relevant configuration close to the files they affect (and in source code control etc).
Some things which will be of note:
- Restricting access to directories/ files either completely or by IP address
- Adding / changing MIME rules
- Getting files other than .php to run as PHP pages
- rewriting (If you're really keen)
But basically it will allow you to structure the URLs how you want which is pretty good.
Mark
The Apache docs actually recommend against using .htaccess. In fact, they recommend disabling it within httpd.conf. This is because when .htaccess is enabled, apache looks for .htaccess file in every higher level directory every time a page is requested. That's a hell of a lot of overhead IMO. They recommend just putting everything in httpd.conf.
Check out the apache documentation if you want to know more.
Throuble is that a shared hosting solution generally doesn't allow you access to the httpd.conf file (I have only seen it once, and that was special because the hoster was a personal friend). In those cases, you're pretty much forced to use .htacces files.
If you have a dedicated server or just run one from home then dropping .htaccess would be good yes :)
If you have a dedicated server or just run one from home then dropping .htaccess would be good yes :)
For MySQL, there are basically only 2 things that you may need to pay a little attention to when configuring it.
First is for transaction support, the table as to be created with the InnoEngine. A one liner in the configuration file can make it the default.
Second, there's no stored procedure in the current stable version which will be in place in the next (5.0) version.
First is for transaction support, the table as to be created with the InnoEngine. A one liner in the configuration file can make it the default.
Second, there's no stored procedure in the current stable version which will be in place in the next (5.0) version.
Quote:
Original post by ontheheap
The Apache docs actually recommend against using .htaccess. In fact, they recommend disabling it within httpd.conf.
They suggest it for performance reasons.
Quote:
This is because when .htaccess is enabled, apache looks for .htaccess file in every higher level directory every time a page is requested.
No it doesn't. It only does so if those directories have AllowOverride set to something other than None.
If you set the AllowOverride in a
Quote:
That's a hell of a lot of overhead IMO.
You're entitled to your opinion, but have you checked out how many file opens running a single PHP page tries to do? It's got to be several dozen even for a simple page.
Quote:
They recommend just putting everything in httpd.conf.
There are two obvious problems with this:
1. The httpd.conf gets very full and messy, very quickly. I know you can break it up with includes, but it's still going to be a nightmare.
2. If you rename, copy or move a directory which is supposed to be protected, you can easily create a security problem because the config will not get moved copied or renamed with it.
I like to keep .htaccess in source code control - something I cannot do so easily if I have to put it all in httpd.conf.
You are just a premature-optimisation junkie. Get over it. A few file open operations is NOT going to slow your web server to a crawl.
Mark
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement