Jump to content

PHP configuration


Recommended Posts

--------------------------------------------------------------------------------

i have a few questions about PHP configuration. Hopefully, you will answer them all for me.

1- I configured apache 2 to work with php and mysql. There is no problem. When i type 127.0.0.1\phpinfo.php in IE, everything works.

what do i need to do to make it work if i type 127.0.0.1\phpinfo in IE's address (this time is no .php extension).?

2- let's say i write a php script and save it in desktop> when i click on it, i want IE to open it and execute it without going to command line and type php example.php.

thank you

Link to comment
Share on other sites


1. add this to httpd.conf

<Files ~ "^[^\.]+$">

       ForceType application/x-httpd-php

</Files>

or

Edit httpd.conf to reflect "AddType application/x-httpd-php"

Edit httpd.conf to reflect "ServerSignature Off"

Edit php.ini file to reflect "expose_php = off"

2. press [shift] and right click to any of the php files, choose [open with] and then select IE.

or

  • open a folder
  • go to tools
  • go to folder options
  • go to file types
  • type PHP in there
  • click on advanced
  • click on new
  • type the action name like "open in IE"
  • beneath that click on browse and browse to IE
  • and click ok
  • after that u can set it to default if u want it to be the default action..

Link to comment
Share on other sites

a) A quick fix would be to rename './data/index.php' into './data' and

then use a ForceType directype to effectively call

http://myserver.com/data

Hint:

<Location "/data">

ForceType application/x-httpd-php

</Location>

B) Alternatively you may also try SetHandler or AddHandler (this depends on your setup) and use a PHP-driven front controller.

Hint:

Alias /php-bin /usr/local/www/.../php-bin

<Location /php-bin>

AllowOverride None

Options Includes

</Location>

w/

<Location "/data">

Action php-script /php-bin/handler.php

SetHandler php-script

DirectoryIndex ./test.foo

</Location>

or

<Location "/data">

Action php-script /php-bin/handler.php

AddHandler php-script .foo

DirectoryIndex ./test.foo

</Location>

Have a look at:

<http://httpd.apache.org/docs-2.0/mod/core.html#forcetype>

<http://httpd.apache.org/docs-2.0/mod/mod_mime.html>

<http://httpd.apache.org/docs-2.0/mod/core.html#sethandler>

<http://www.onlamp.com/lpt/a/4987>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...