Page 1 of 1

Problem with php and Apache

Posted: Fri Dec 31, 2004 1:30 pm
by feartetsuo
Ok. I installed PHP v5 and Apache 2 on my computer. I set it up because I want to run PHP scripts on my computer. I need a bigger max upload size in my php.ini setting. So I changed it in all the php.ini files I had on my computer. I run Apache and type in my php page to see my php info and it always says that the max upload size is 2mb, not what I set it too. I loaded the code to find out my php info and located the directory where it said it was using the php.ini file from. I deleted it and restarded apache to see what would happen. And it still works!! And it even says that it is using the php.ini file from where I just deleted it from. Please tell me that someone has had this happen before and it can be fixed. Thanks.

Also, whenever I start apache I get this error message. But apache still works and runs fine. Here is the image and the code that it said is a mismatch:
Image

line 968 is:

Code: Select all

AddType application/x-httpd-php .php 
ScriptAlias /php/ "c:/php/"  <---------968 
AddType application/x-httpd-php .php

Re: Problem with php and Apache

Posted: Mon Jan 24, 2005 1:32 am
by CyberSpatium
Ok. I installed PHP v5 and Apache 2 on my computer. I set it up because I want to run PHP scripts on my computer. I need a bigger max upload size in my php.ini setting. So I changed it in all the php.ini files I had on my computer. I run Apache and type in my php page to see my php info and it always says that the max upload size is 2mb, not what I set it too.
when you change any settings in your php.ini or httpd.conf files, you need to restart apache to make the new settings take effect.

I loaded the code to find out my php info and located the directory where it said it was using the php.ini file from. I deleted it and restarded apache to see what would happen. And it still works!!
Apache does not need your php.ini file for it to start. The php.ini file just tells apache how php is configured to run on your server. The only thing that will happen by deleteing your php.ini file is you will not be able to use php scripts.

Also, whenever I start apache I get this error message. But apache still works and runs fine.
a possible reason that apache starts but gives error messages is that you had two entries in your code above for AddType application/x-httpd-php .php. Remove one of them. Also, change ScriptAlias /php/ "c:/php/" to Alias /php/ "c:/php/". And I would add an AddHandler to handle php scripts.

Also, to be safe, I woud use AddType to make apache process include files (.inc) and php source files (.phps), otherwise, if someone tries to access those pages with their browser, they will see your php source code, not the parced php webpage.

Here is how the new code should look:

Code: Select all

Alias /php/ "c:/php/"
AddHandler php-script .php
AddHandler php-script .inc
AddType application/x-httpd-php .php
AddType application/x-httpd-php .inc
AddType application/x-httpd-php-source .phps
CyberSpatium