/    Sign up×
Community /Pin to ProfileBookmark

configuring apache to work with php

ScriptAlias .php/ “c:/php”
AddType applications/x-httpd-php .php
Action application/x-httpd-php “/php/php.exe”

i put that in my httpd.cong file but now i dont know where to store my php files so i can test them on my localhost?

to post a comment
PHP

15 Comments(s)

Copy linkTweet thisAlerts:
@Paul_JrApr 10.2004 — If you installed Apache in the default location, then it's probably something like “[i]C:Program FilesApache GroupApachehtdocs[/i]”. That's where all of your files will go. To access them you'd go to [i]http://localhost/file_name.php[/i] or [i]http://127.0.0.1/file_name.php[/i].
Copy linkTweet thisAlerts:
@ConorauthorApr 10.2004 — maybe you can tell me what you put in your apache thing to make it accept php files i just got

<?php

phpinfo();

?>
Copy linkTweet thisAlerts:
@ConorauthorApr 10.2004 — got it working used this

ScriptAlias /php/ "c:/php/"

AddType application/x-httpd-php .php

Action application/x-httpd-php "/php/php.exe"
Copy linkTweet thisAlerts:
@Paul_JrApr 10.2004 — Did you manually install PHP, or use InstallShield?

Manual installation is as follows:

Begin by unzipping the Zip file to the directory of your choice. The usual location is c:PHP, and we will use this in the following explanation.
[list=1]
  • [*]In the main directory you will see a file called php.exe, and one called php4ts.dll. These are the files you will need to run PHP as a CGI. If you would like to run it as a SAPI module you will need to look in the directory c:PHPsapi and copy the relevant DLL file to C:PHP. If you are using Apache, the file is called php4apache.dll for example.

    The SAPI modules are faster and easier to secure; the CGI version allows you to run PHP from the comamand line. Again, the choice is up to you.


  • [*]Copy the contents of c:PHPdlls to your Windows sytem directory. This will be c:winntsystem32 on Windows NT or 2000, or c:windowssystem32 on Windows XP.


  • [*]Move the directory c:PHPmibs to c:usrmibs.


  • [*]Set up a php.ini configuration file. PHP comes with two prepared files: php.ini-dist and php.ini-recommended. We suggest you use php.ini-recommended. Make a copy of thi sfile nad rename it php.ini. Place your php.ini file in the &#8220;%SYSTEM-ROOT%*#8221; directory. This is usually c:winnt or c:winnt40 on Windows NT or 2000, or c:windows on Windows XP.


  • [*]Edit your PHP ini file. There are many settings in it, most of which can be ignored for the time being. The settings you need to change now are
    [list]
  • [*]Change the extension_dir directive to point to the directory where you extension DLLs reside. In the normal install this will be C:PHPextensions.

    Your php.ini file will therefore contain

    [FONT=courier new]extension_dir = c:/php/extensions[/FONT]


  • [*]Set the doc_root directive to point at the root directory that your Web sever serves from. This is likely to be

    [FONT=courier new]doc_root = "c:/Program Files/Apache Group/Apache/htdocs/"[/FONT]

    if you are using Apache, or

    [FONT=courier new]doc_root = "c:/Inetpub/wwwroot"[/FONT]

    if you are using IIS.


  • [*]You can also choose some extensions to run. We suggest at this stage that you just get PHP working; you can dll extensions as needed. In order to add an extension, just look at the list under &#8220;Windows Extensions*#8221;. You will see a lot of lines such as

    [FONT=courier new];extension=php_pdf.dll[/FONT]

    In order to turn this extension on, you can simple remove the semicolon at the start of the line (and do the opposite to turn it off). Note that if you want to add more extensions later, you should restart your Web server after you have changed [FONT=courier new]php.ini[/FONT] in order for the changes to take affect.

    Close and save your [FONT=courier new]php.ini[/FONT] file.

  • [/list]


  • [*]If you are using NTFS, make sure the user that the Web server runs as has permission to read your php.ini file.

  • [/list]
    [/quote]



    If there are any typos... then, well, oh well. ?

    [i]I guess you can't nest lists here...[/i]
    Copy linkTweet thisAlerts:
    @ConorauthorApr 10.2004 — thanks paul ?
    Copy linkTweet thisAlerts:
    @Paul_JrApr 10.2004 — Lol. I just noticed you posted that you had figured it out after I finished editing. Oh well, it's here if anyone else needs it. ?
    Copy linkTweet thisAlerts:
    @ConorauthorApr 10.2004 — now that i have php done is there anything that has to be configured in mysql now that i have it installed and if so where?
    Copy linkTweet thisAlerts:
    @Paul_JrApr 10.2004 — There really isn't that much you have to do for MySQL. Assuming you didn't move the folder from where it was defaultly installed...


    [b]Setting your Path[/b]

    MySQL comes with lots of command line utilities with varying degrees of usefulness. None of these are easy to get at unless the MySQL binary directory is in your [FONT=courier new]PATH[/FONT]. The purpose of this environment variable is to tell Windows where to look for executable programs.

    Many of the common commands you use at the Windows command prompt, like [FONT=courier new]dir[/FONT] and [FONT=courier new]cd[/FONT], are interal and built into cmd.exe. Others, like [FONT=courier new]format[/FONT] and [FONT=courier new]ipconfig[/FONT], have their own executables. It would not be convenient to have to type C:WINNTsystem23format if you wanted to format a disk. It would not be convenient to have to type C:mysqlbinmysql to run the MySQL monitor.

    The directory taht the executables for your basic Windowx commands, like format.exe, reside in is automatically in your PATH, so you can simple type format. In order to have the same convenience with the mysql command line tools, we need to add it.

    Click Start, and choose Settings, Control Panel. Double-click System, and go to the Advanced tab. If you click the Environment Varibles button, you will be presented with a dialog box which allows you to view the environment variables for your system. Double-clicking PATH will allow you to edit it.

    Add a semicolon to the end of your current path to separate your new entry from the previous one then add [FONT=courier new]c:mysqbinmysql[/FONT]. When you click OK, your addition will be stored in the machine's registry. Next time you restart the machine, you will be able to type [FONT=courier new]mysql[/FONT] rather than [FONT=courier new]C:mysqlbinmysql[/FONT].


    [b]Deleting The Anonymous User[/b]

    The default configuration of MySQL allows any user access the system without providing a username or password. This is obviously undesirable.

    The first thing we want to do is delete the anonymous user. Opening a command prompt and typing the folowing lines will accomplish that.

    [FONT=courier new]c:mysqlbinmysql[/FONT]

    [FONT=courier new]use mysql[/FONT]

    [FONT=courier new]delete from user where User='';[/FONT]

    [FONT=courier new]quit[/FONT] [FONT=courier new]c:mysqlbinmysqladmin reload[/FONT]

    The anonymouse user is now gone.


    [b]Setting The Root Password[/b]

    Even the superuser account, root, ahs no pasword yet. To set this user's password type in these lines

    [FONT=courier new]c:mysqlbinmysqladmin -u root password your_password

    c:mysqlbinmysqladmin -u root -h your_host_name password your_password[/font]

    You should fine that tasks that previously required no username or password will now fail without this information. Attempting to run

    [font=courier new]c:mysqlbinmysqladmin reload[/font]

    or

    [font=courier new]c:mysqlbinmysqladmin shutdown[/font]

    will now fail.

    From now on, you will need to use the [FONT=courier new]-u[/FONT] flag and provide a username, and the [FONT=courier new]-p[/FONT] flag to tell MySQL that you have a password, as in this example:

    [FONT=courier new]c:mysqlbinmysqladmin -u root -p reload[/FONT]

    If you type this command MySQL shoudl now prompt you for the root password that you just set.

    If you ned more information, please refer to the MySQL Website,

    [URL=http://www.mysql.com]http://www.mysql.com[/URL].
    [/quote]


    I'm never going to type a single word again! :p
    Copy linkTweet thisAlerts:
    @ConorauthorApr 10.2004 — ok i set up the password and deleted anymous but i have a question. Im trying to set up phpmyadmin any idea what i have to put? for the password and user
    [code=php]
    $cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
    $cfg['Servers'][$i]['user'] = ''; // MySQL user
    $cfg['Servers'][$i]['password'] = ''; // MySQL password
    [/code]
    Copy linkTweet thisAlerts:
    @Paul_JrApr 10.2004 — The username and password you set when you set up the MySQL root user? I'm not exactly sure, since I've never used PHPMyAdmin.
    Copy linkTweet thisAlerts:
    @ConorauthorApr 10.2004 — i dont think i ever set up a root user when is that done?

    im getting this error

    #2003 - Can't connect to MySQL server on 'localhost' (10061)
    Copy linkTweet thisAlerts:
    @The_CheatApr 10.2004 — use root as the username. use localhost as host. enter the password you changed the root password to for password.
    Copy linkTweet thisAlerts:
    @ConorauthorApr 10.2004 — yeah i did that and its stilling throwing the same error for me. IS there more i have to do besides the install wizard and what paul posted, i must have done something wrong


    ok ive go it working and here the thing that did it

    my original line:

    $cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin';

    the line that made it work:

    $cfg['PmaAbsoluteUri'] = 'http://localhost:80/phpmyadmin';
    Copy linkTweet thisAlerts:
    @The_CheatApr 10.2004 — weird.

    well, glad you got it to work.
    Copy linkTweet thisAlerts:
    @Sexay_HamsterApr 27.2004 — dont use phpmyadmin. it is terrible IMO. use mysql control center. its a win32 app and is much better.
    ×

    Success!

    Help @Conor spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.27,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...