guitarrick40 Posted April 15, 2008 Share Posted April 15, 2008 Hello out there. I'm a newbie to networking/webdesign. I am attempting to learn how to create and host a website utilizing my home .LAN w/ server 2003. I have embarked on the AMP module or the apache/php/mysql method via a book a have. I have successfully installed Apache and can see my test file from http://localhost. The next step was to insert the following txt into the Apache edit file: Adding PHP to the Equation In order for Apache to recognize a PHP file as one that needs to be parsed with the PHP engine, you need to first locate the following lines in your httpd.conf file: # # AddType allows you to add to or override the MIME configuration # file mime.types for specific file types. # AddType application/x-tar .tgz AddType image/x-icon .ico Then add the following lines: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps Now add the PHP module into your httpd.conf program so that Apache can properly parse PHP. In your script, locate the following lines: Add the following line: LoadModule php5_module “c:/php/sapi/php5apache2.dll” Make sure your path matches the location of this file, as determined during your installation. //MY APACHE TEST FILE WORKS FROM THIS LOCATION-SO THIS IS WHERE I PUT PHP FILE> #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule ssl_module modules/mod_ssl.so #LoadModule php5_module "f:/Programs/php/sapi/php5apache2.dll" AddType allows you to add to or override the MIME configuration # file mime.types for specific file types. # #AddType application/x-tar .tgz #AddType application/x-icon .ico #AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps Then, having no experience with any language other than current study of c++, I copied the recommended test php file as such: <HTML> <HEAD> <TITLE>PHP Testing</TITLE> </HEAD> <BODY> <?php echo "If this works, we <i>really</i> did it!"; ?> </BODY> </HTML> //It DOESN'T!! //THIS FILE IS IN A FOLDER CALLED 'WEB' WHERE MY HTML TEST FILE FOR APACHE IS. IT IS THE DESIGNATED ROOT FILE WITHIN THE CONFIG FILE OF APACHE AND ONCE AGAIN, WORKS FROM A BROWSER CALL. Any help getting me going will be greatly appreciated, I have to also get theMYSQL variable factored in also!! Regards, RG Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/ Share on other sites More sharing options...
wildteen88 Posted April 15, 2008 Share Posted April 15, 2008 When configuring Apache you can place the configuration lines anywhere in the httpd.conf there is no standard, so don't worry about where you place the configuration lines you book tells you too. When configuration Apache with the PHP module make sure you use the correct module for the version of Apache you have installed. If you have Apache 2.2.x installed then you should use the provided php5apache2_2.dll module that comes with PHP, instead and not the older php5apache2.dll module (which is for Apache2.0.x only). Your book may not explain this as it was most probably published before Apache2.2.x was released. I mentioned this as it is a common pitfall for using the incorrect module for the version of Apache installed. Also PHP5 does not come with a sapi folder so I don't know why your book is instructing you to add the following line to the httpd.conf: LoadModule php5_module "c:/php/sapi/php5apache2.dll" It should be: LoadModule php5_module "c:/php/php5apache2.dll" NOTE: Make sure whenever you make any changes to the httpd.conf that you restart Apache (Via the Start menu or taskbar icon). You should place your PHP files in your "document root" by default it is C:/[path/to/apache]/htdocs Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-517788 Share on other sites More sharing options...
guitarrick40 Posted April 15, 2008 Author Share Posted April 15, 2008 When configuring Apache you can place the configuration lines anywhere in the httpd.conf there is no standard, so don't worry about where you place the configuration lines you book tells you too. When configuration Apache with the PHP module make sure you use the correct module for the version of Apache you have installed. If you have Apache 2.2.x installed then you should use the provided php5apache2_2.dll module that comes with PHP, instead and not the older php5apache2.dll module (which is for Apache2.0.x only).................. tHANKS WILDTEEN I've gotten a little closer: I am in fact running v2.0 Apache; so that can't be the problem. I also like to confuse myself with multiple partitions so; I discovered I had my load module file pointing to the wrong directory. Now, when I type the http://localhost/phptest.php; I get a blank page instead of the 'can't be found' bad address response. Now, I can't get my echo to show up! Any help please..........and THX MUCH!!!!>>>>> Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-517987 Share on other sites More sharing options...
PFMaBiSmAd Posted April 15, 2008 Share Posted April 15, 2008 Blank php pages are usually the result of a fatal parse error or using short open tags <? Do a "view source" in your browser and post the script you are trying to run. If you are learning php, developing php code, or debugging php code, turn on display_errors and full php error_reporting in your php.ini to get php to help you (for example with a fatal parse error.) Use these two settings in your php.ini (stop and start your web server to get any change made to php.ini to take effect) - error_reporting = E_ALL | E_STRICT display_errors = On Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-518029 Share on other sites More sharing options...
guitarrick40 Posted April 15, 2008 Author Share Posted April 15, 2008 Thank you - but how do I do a "View Source" in my browser to display my php text? Or should I now hop over to a PHP forum?? I did set display errors to on; but nothing is kicked out. Still have an all white -RG Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-518060 Share on other sites More sharing options...
PFMaBiSmAd Posted April 15, 2008 Share Posted April 15, 2008 Doing a view source in your browser was one separate action. Posting your script (from the source file) was a different action. Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-518070 Share on other sites More sharing options...
guitarrick40 Posted April 16, 2008 Author Share Posted April 16, 2008 OOOPS! Sorry about that. I thought you meant some sort of a php command thing. I can view my source code on my phptest.php page. So what does that tell me>? Quote Link to comment https://forums.phpfreaks.com/topic/101198-using-php5-w-apacheii/#findComment-518095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.