Jump to content

Archived

This topic is now archived and is closed to further replies.

marek

installation problems

Recommended Posts

Hello,

I'm totally new on this forum and totally fresh at PHP.
I have some installation problems with PHP. I've installed Apache 1.3 and then PHP 5. Everything step by step with php manual.
The server is working properly but when I created test php file with <? phpinfo() ?> instruction it displays <? phpinfo() ?> except for php inf site.

Where is the problem?
Thanks for your help.
Marek

Share this post


Link to post
Share on other sites
Try...
[code]
<?php phpinfo() ?>
[/code]
You should avoid trying to use short tags.

Share this post


Link to post
Share on other sites
[!--quoteo(post=380080:date=Jun 5 2006, 02:20 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 5 2006, 02:20 AM) [snapback]380080[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try...
[code]
<?php phpinfo() ?>
[/code]
You should avoid trying to use short tags.
[/quote]

Nothing has changed.
Now it just dispalys <?php phpinfo() ?> instead of <? phpinfo() ?>.
So I still think it's installation problem (that Apache server "doesn't see" the code of PHP).
By the way, I did the instalation with PHP manual.

Thanks for help
Marek

Share this post


Link to post
Share on other sites
Did you remember to install the module plugins for PHP in Apache? (it's not really *installing* just adding them to the .conf file.)

Share this post


Link to post
Share on other sites
Yes.
I have added four lines to httpd file:
LoadModule php5_module "C:/PHP/php5apache.dll"
AddModule mod_php5.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
By the way, is the place of these lines in this httpd file important?

Marek

Share this post


Link to post
Share on other sites
Okay run through these points:[list][*]Check that php.ini is in either in C:\WINDOWS or C:\WINDOWS\SYSTEM32
[*]Check that php5td.dll is also either in the C:\WINDOWS or the C:\WINDOWS\SYSTEM32 folder
[*][!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--]ONLY DO THE ABOVE TWO STEPS IF YOU HAVE NOT ADDED THE LOCATION OF THE PHP FOLDER TO THE WINDOWS PATH VARIABLE[!--sizec--][/span][!--/sizec--]
[*]Check that any configurations settings within the php.ini are correct
[*]Change the [i]display_startup_errors[/i] (located near line 372 in the php.ini file) directive from Off to On, so it is read as the following:
[code]display_startup_errors = On[/code]
Now restart Apache, If there are any errors with the PHP configuration you should get an error message telling you whats wrong when Apache attempts to restart/load
[*]Check Apache's error log for any startup errors. Apache's error log is located in the logs folder within the Apache installation folder.
[*]Make sure that your restart Apache when you make any changes to the php.ini/httpd.conf file and when you move any files that is stored either in the PHP folder or the Apache folder.[/list]

Share this post


Link to post
Share on other sites
1. I already have c:\PHP in my windows path variable
2. I have php.ini on c:\windows
3. I have php5ts.dll on c:\php
4. I have aded two lines in php.ini:

doc_root = c:\Program Files\Apache Group\Apache\htdocs
extension_dir = c:/PHP/ext

and I have changed display_startup_errors from Off to On.

5. I have restarted Apache
6. Error in Apache logs is:
File does not exist: c:/program files/apache group/apache/htdocs/favicon.ico
7. Web localhost works properly.

Still doesn't work.
So if I have c:\php in windows path variable,
I should delete php.ini from c:\windows and php5ts.dll form c:\php?

Marek

Share this post


Link to post
Share on other sites
If you have the php folder in the windows path variable than move php.ini back to C:\php and add the following line of code to the httpd.conf file:
[code]PHPIniDir "C:/php"[/code]

Now save the httpd.conf file and restart Apache.
Also I notice you added this line in the httpd.conf:
[code]AddModule mod_php5.c[/code]
this is not actually needed.

Alsol when you added the PHP to window path variable make sure it is correct and when you created the variable that you restarted windows in order for the new path variable to become available.

Share this post


Link to post
Share on other sites
1. After I added: PHPIniDir "C:/php" to httpd.conf file, I got the message it's invalid command.
So I deleted it.

2. I moved php.ini to c:/php

3. My windows path variable looks like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\PHP

3. I also used command line and in windows directory run php -i. It worked properly.

4. Web localhost works properly.

But Apache and PHP still dont't want to work together.

Marek

Share this post


Link to post
Share on other sites
How are you saving your php files? are you saving them with a .php extension?

As far as I can see there is nothing wrong with how Apache and PHP are configured.

Share this post


Link to post
Share on other sites
I save them with .php extension. The name is test.php. And it includes only one line: <? php phpinfo() ?>.
I really don't know what to do now.
Thanks anyway.
Marek

Share this post


Link to post
Share on other sites
It's me again. I still have the same problem. Nothing has changed.
When I run php -i in windows directory, it works properly.
I can see page localhost on Apache.
But still browser can't see the php code.
So in my opinion the problem is only about settings in httpd.conf file.
Am I right?

Marek

Share this post


Link to post
Share on other sites
I gave up with. I've tried so many times make this work... But still the same problem.
So I've changed Apache 1.3 for Apache 2.0.
In php manual it's said that I have to add:

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

Is this really all?
Is the place of these lines in httpd.conf file important?

Thanks
marek

Share this post


Link to post
Share on other sites
Yes at minmun three lines of configuration code is whats needed to tie Apache and PHP together!

Where you place these lines doesn't matter but I preferr to put them in thier proper place:
[code]LoadModule php5_module "c:/php/php5apache2.dll"
PHPIniDir "C:/php"[/code]
At the end of the LoadModule list which is after this line:
[code]#LoadModule ssl_module modules/mod_ssl.so[/code]

I add this line:
[code]AddType application/x-httpd-php .php[/code]
after:
[code]AddType application/x-gzip .gz .tgz[/code]

and thats it! However you can place anywhere if you wish but I prefer not to.

Share this post


Link to post
Share on other sites
It's working!
I made two things together that helped.
Firstly I moved php.ini to C:/WINDOWS and changed line in httpd.conf file from PHPIniDir "C:/php" to PHPIniDir "C:/WINDOWS".
Secondly I added .txt at the end of the line: AddType application/x-httpd-php .php .phtml. I did this because I noticed that my file test.php on web localhost is shown as test.php.txt (actually, I don't know why).
I restared server and I could see beautiful phpinfo side.
Thanks to everyone that helped me on this forum (asspecially wildteen88).
Now I can start to learn php (I think I'll have more problems since now).


Share this post


Link to post
Share on other sites
About the .txt thing are you saving your files in notepad/wordad?

if you are, make sure when you go to save your files with the .php extension within notepad the [b]save as type[/b] select box has [b]All Files[/b] selected.

Notepad will save any file with the txt file extension by defualt.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.