Click to See Complete Forum and Search --> : php5 & apache 2 install
jer99
01-02-2006, 12:47 PM
I successfully installed Apache 2 and am trying to install php 5
Whenever I go to my index.php, it brings it up in an editor rather than
running it.
here's what I have done so far:
I have renamed the php.ini-recommended file to php.ini
I added the "extension_dir = c:\php" to the ini
I have placed it in my windows directory
I took the php5ts.dll and placed it in the system32 directory
I have inserted the following in the httpd.conf:
LoadModule php5_module c:/php/php5apache2.dll
ScriptAlias /php/ "c:/php"
Action application/x-httpd-php "/php/php.exe"
AddType application/x-httpd.php .php .phtml
I changed the php.ini to allow short directives (<?....?>)
I created the following in my apache htdocs directory (index.php):
<html>
<head>
<title> My Test Page </title>
<body>
<p> My first php: <? echo "hello world!"; ?></p>
</body>
</html>
When I type: "http://localhost/index.php " in the browser, it wants to associate a program with the file type rather than just running it.
Anything else I have missed or any ideas?
jer99
01-02-2006, 04:03 PM
Sometimes it just takes a while.....
I used wAMP5 to install and it went great. I compared the installs.
The problem was I forgot to place quotes around the location of the php5_module.
I removed wAMP5 and manually loaded Apache, PHP5, MySQL and everythign worked like a champ!
Thanks wamp5!
bpat1434
01-02-2006, 05:57 PM
Hmm... if you read teh PHP manual, it tells you to stay away from moving any files into the Windows system directories. I'd advise against it as well.
You can circumvent the whole moving php.ini in Apache with one little line:
PHPIniDir = C:/php
And this line: AddType application/x-httpd.php .php .phtml should be:
AddType application/x-httpd-php .php .phtml
~Brett
jer99
01-02-2006, 09:09 PM
Now I'm stumped.
I started again with the intent of making the file structure make more sense and also to do it without wamp5. The main directory would be F:/Business/Web . Under that I have a /Programs and a /Site/root . I unloaded the old and reinstalled.
I added:
PHPIniDir "F:/Business/Web/Programs/PHP" (no equal sign)
and it worked but it's having a problem finding php_mysql.dll and php_mysqli.dll
I read the FAQ and the earlier message. I checked the phpinfo() and the configuration file is in the appropriate directory (F:/Business/Web/Programs/PHP)
The libmysql.dll is in the same path as the ini.
In the php.ini I have the lines:
extension_dir = "../php/ext/"
and
extension=php_mysql.dll
extension=php_mysqli.dll
It finds the other dlls. And the php_mysql.dll is in the directory with the others.
it tells me it cant find it but it finds the others. Any ideas?
I wish I was younger so I could pull out more hair.
:confused:
bpat1434
01-03-2006, 12:12 AM
If it's not much trouble, I'd say follow this guide (download latest versions of course) as it really steps you through it.
Install & Configure Apache 2, PHP 5 (http://mpcon.org/apacheguide/index.php)
1.) Try giving a direct path to the extensions directory (most likely won't do it)
2.) Double check that libmysql.dll is in the directory with "php.exe"
3.) Double check that php_mysql(i).dll is in fact in the ext directory. Depending upon the version you downloaded, you may have to get them.
~Brett
ellkle
01-03-2006, 05:21 AM
Hi PHP & Apache install thread,
I just installed from source, PHP 5.1.1 & Apache-2.2.0 running Suse 10.0 linux.
When I try to run the apache server I get the following error:
% httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: undefined symbol: zend_ini_string
My php config was:
% ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-zlib --with-gd
Anybody run across this problem?
(I am new to Apache 2.* and PHP 5.*)
I installed apache and php using the default locations.
Thank you,
Elliot
malani_manish
01-03-2006, 05:33 AM
Hi Elliot,
you must have installed apache with './configure --enable-so' command.
Try to reinstall apache, php after it, to some other location and see if it work?
Manish
jer99
01-04-2006, 10:28 PM
Getting much closer.
I used the instructions from the previous message reference (http://mpcon.org/apacheguide/index.php) and it worked..almost.
Turns out that once I re-booted, everything cured itself. At least i can say that mysqli.dll is loaded without error.
Two remaining quesitons:
1) The instructions do not mention uncommenting the line for the mysql.dll. What are the consequences of only loading mysqli.dll?
2) I can not get PHPMyAdmin to work. I think it has to do with the location. My structure currently has all the "programs" in one directory and the site in a parallel directory - like this:
F:\Business\Website\ Programs
F:\Business\Website\ Programs\Apache
F:\Business\Website\ Programs\PHP
F:\Business\Website\ Programs\PHPMyAdmin
F:\Business\Website\ Programs\SpiceMatrix\server\root (actual root directory)
F:\Business\Website\ Programs\SpiceMatrix\server\test
Is there a way to tell the server that the location of the phpmyadmin program?
Or would you bite the bullet and place it in a subdirectory off of root?
Thanks for all the help everyone.
The hair is coming back.
bpat1434
01-04-2006, 10:53 PM
1.) mySQLi is a better version of mySQL. So not loading mysql.dll will have no consequences. The difference is the syntax PHP uses. You have to use mySQLi syntax, not mySQL. There area few, not many, but a few.
2.) phpMyAdmin must be run from the root-directory of your server. I haven't found a way around that. So if in Apache you specify "F:\Business\Website\Programs\SpiceMatrix" as your root, just put "PHPMyAdmin" as a sub-directory of "SpiceMatrix". Otherwise, add one more layer, and make that your root:
F:\Business\Website\Programs\root\PHPMyAdmin
F:\Business\Website\Programs\root\SpiceMatrix
etc.
~Brett
jer99
01-11-2006, 10:19 PM
Thanks for all the help.
I finally got it working but had a very interesting problem that I hope won't bite me later on.
I tried accessing it and it said it couldn't write a file in line 51 in index.php (for MyPHPAdmin).
That line is when it is doing a call to session_write_close();
turns out that I hapd to add a tmp directory to my root webserver directory.
Everything worked out great after that.
It wasn't mentioned in the configure document, but at least everyone is working together fine.
jborges
01-17-2006, 06:01 PM
Above Brett recommended jer99 to add PHPIniDir "C:/php". Afterwards jer99 decided to change it to PHPIniDir "F:/Business/Web/Programs/PHP" (no equal sign).
What it means?? If I want to have my php documents (like index.php) in d:\programs\php I would be recommended to make it PHPIniDir "d:\programs\php" ???
Now I have my index.php (the only one I have made so far) in c:\program files\apache group\apache2\htdocs.
What I have to do to make php and apache to find my index.php in d:\programs\php ???
Thanks a lot
Julio Borges
Rio de Janeiro
bpat1434
01-18-2006, 12:28 AM
NO no no.
PHP should NOT be installed into the web-server root.
Here's how i have mine setup:
Web Root: K:\Websites\
Apache: C:\Program Files (x86)\Apache Group\Apache2
PHP: C:\Program Files (x86)\Apache Group\php
Now, your php.ini file should be in the PHP directory (PHP above). In Apache, you specify your document root (Web Root above). In the httpd.conf file you specify the PHPIniDir attribute and point that to the PHP install dir (PHP above).
Mine would read:
PHPIniDir "C:\Program Files (x86)\Apache Group\php"
If you can't get Apache and PHP running properly, google for a tutorial (there are plenty) and they should pretty-much step you through the items....
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.