Hi Guys,
Im new to PHP and this is my first time on your forum so bear with me.
I have installed Apache, MYSQL and PHP on to a Vista OS, the Apache side of things seems to be working OK but when i try to pull up an PHP document Vista asks me if i want to allow this, then if i want to open or save.
If i click open, it then opens the documents in notepad and shows me the code i have entered.
The PHP document i am trying to use is a simple PHP info doc which in theory should show me the information from my PHP ini file.
I have added code to the loadmodule and Addtype sections of the HTTPD.conf file in Apache which seem to run just fine without error.
If anybody can tell me where i am going wrong or why this is happening i would be most grateful as it is the first piece of PHP scripting i have tried and it seems to not be working for no apparent reason.
Thanks in advance,
drp
New to PHP
Moderator: General Moderators
Re: New to PHP
First things first, how are you opening the page?
Normally you would go to something like the following:
http://localhost/ or http://127.0.0.1/
http://localhost/mypage.php
On Windows, the server directory is normally where ever you have installed apache.
Ex:
C:/Program Files/Apache/htdocs/
Normally you would go to something like the following:
http://localhost/ or http://127.0.0.1/
http://localhost/mypage.php
On Windows, the server directory is normally where ever you have installed apache.
Ex:
C:/Program Files/Apache/htdocs/
Re: New to PHP
Apache has no problem finding the document, it simply opens it with notepad instead of running the PHP script.
To open the page i goto http://localhost/phpinfo.php.
The file itself is saved as "phpinfo.php".
Sorry if i am not making myself clear, as i said i'm new to PHP.
Thanks for looking at this for me.
drp
To open the page i goto http://localhost/phpinfo.php.
The file itself is saved as "phpinfo.php".
Sorry if i am not making myself clear, as i said i'm new to PHP.
Thanks for looking at this for me.
drp
Re: New to PHP
Perhaps a stupid question, but di you restart Apache after you change it's httpd.conf?
Also, adding the below might help? Just a thought...I'm not that familiar with Apache, but I found it in another .conf. Worth a shot?
Also, adding the below might help? Just a thought...
Code: Select all
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phpsRe: New to PHP
Yeah, i restarted Apache after altering the .config file, i'm wondering if it's something to do with either file association (so my PHP files are being opened by notepad), or wether i have screwed up the .config somewhere and PHP files are simply not being parsed by the browser.
It's weird though because i have bought 2 books on the subject and they have given me almost identical instructions, both yielding the same results.
I have also tried both scripting versions for the addtype command (.php and .phps) but neither seem to change the result or solve the issue.
Thanks for your help.
drp
It's weird though because i have bought 2 books on the subject and they have given me almost identical instructions, both yielding the same results.
I have also tried both scripting versions for the addtype command (.php and .phps) but neither seem to change the result or solve the issue.
Thanks for your help.
drp
Re: New to PHP
I think that's it. I've had similar problems on Windows. Don't get discouraged. It will work, but you have to outsmart Microsoft, they don't want you to use open source products!drp wrote:... or whether i have screwed up the .config somewhere and PHP files are simply not being parsed by the browser.
Re: New to PHP
Ok, i have added the script given by Jam but to no avail, i have also tried installing firefox and launching it from there with the same results.
I tried to tell the PC to open the file using the browser rather than notepad, This then opened an endless series of windows.
As far as i can tell everything is in order and as it should be but the code is just not behaving the way it should.
I do have a Mac i could install AMP on but i would really rather use the PC.
Any other ideas as to why this might be happening?
Thanks for all your help,
drp
I tried to tell the PC to open the file using the browser rather than notepad, This then opened an endless series of windows.
As far as i can tell everything is in order and as it should be but the code is just not behaving the way it should.
I do have a Mac i could install AMP on but i would really rather use the PC.
Any other ideas as to why this might be happening?
Thanks for all your help,
drp
Re: New to PHP
Few things..
Make sure you put the php dll files in the correct place.
Check the apache error log for any errors (including startup errors)
Post your httpd.conf file.
Make sure you put the php dll files in the correct place.
Check the apache error log for any errors (including startup errors)
Post your httpd.conf file.
Re: New to PHP
http://www.wampserver.com/en/ is all-ion-one (well, basicly, for beginners), that might be of interest if you don't want to dwell into deeper settings within the apache, php and mysql settings. You wont learn as much, but you might want to take it one step at a time...
Other ideas is to drop (or move) your httpd.conf in your trashcan, and restart apache. If it starts at all, it's reading from a different source, rather than the one your editing. Might sound stupid, but a thought. i recall having done similiar stupid mistakes to both httpd.conf and php.ini in my days...
Other ideas is to drop (or move) your httpd.conf in your trashcan, and restart apache. If it starts at all, it's reading from a different source, rather than the one your editing. Might sound stupid, but a thought. i recall having done similiar stupid mistakes to both httpd.conf and php.ini in my days...