Avatar of pepps11976
pepps11976
 asked on

PHP Help Please

Hi all i have posted a similar question but i am now getting a different error so i thought i would start a new question.

Trying to get .php working on my iis 6 windows server and cannot get this working, i have followed various guides which all seem to contradict each other about versions etc.

I have installed Fast CGI and downloaded the zip file for php version 5.3.17 Thread safe

i have created a phpinfo.php file and put it on my site which has this inside

<?php phpinfo(); ?>

but when i browse to it i get the following error

The page cannot be displayed
 You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
--------------------------------------------------------------------------------

Please try the following:
 •Contact the Web site administrator if you believe this directory should allow execute access.
 
HTTP Error 403.1 - Forbidden: Execute access is denied.
Internet Information Services (IIS)
 
--------------------------------------------------------------------------------

Technical Information (for support personnel)
 •Go to Microsoft Product Support Services and perform a title search for the words HTTP and 403.
 •Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Configuring ISAPI Extensions, Configuring CGI Applications, Securing Your Site with Web Site Permissions, and About Custom Error Messages.
 •In the IIS Software Development Kit (SDK) or at the MSDN Online Library, search for topics titled Developing ISAPI Extensions, ISAPI and CGI, and Debugging ISAPI Extensions and Filters.


i really need help on this as i cannot install our new website and this has been going on for 3 days now.

Please please can someone help me
PHPMicrosoft IIS Web Server

Avatar of undefined
Last Comment
Slimshaneey

8/22/2022 - Mon
Slimshaneey

In IIS6, look up the website properties (Right click -> choose properties) and set Home Directory -> Execute Permissions to Scripts Only or higher
pepps11976

ASKER
It is set to scripts and executables i have also tried scripts only still the same
Slimshaneey

OK, next step is to look at the permissions for the folder in Windows. So, in Windows explorer, right click the home directory for the site and check permissions there. Does the IUSR_<machinename> user have read & execute permissions on that folder?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
pepps11976

ASKER
Ok the site folder did not have IUSR permissions but now it has the following

Read and execute
List Folder Contents
Read

Still the same error though
Loganathan Natarajan

pepps11976

ASKER
the permissions are set to the above
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Slimshaneey

Is the folder located in Inetpub\wwwroot? Or somewhere else?
pepps11976

ASKER
its located somewhere else
Loganathan Natarajan

It is the folder located in Inetpub\wwwroot
Your help has saved me hundreds of hours of internet surfing.
fblack61
Slimshaneey

Is it located on a physical disk on that machine or a remote disk? It could be that permissions you are setting locally arent being picked up by the host server hence the errors. I had a similar issue in the past (Althoug on IIS7)
pepps11976

ASKER
its on a physical disk on the machine, i think it has something to do with the php setup, i must of read 50 articles trying to get this working all articles telling you to do different things.. Crazy....

John
Slimshaneey

It could be worth creating a folder in wwwroot folder. In that copy your simple phpInfo script. CHange the home directory to your new folder and see if the same issue happens. If it does, its an IIS config issue
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
pepps11976

ASKER
Yes just done that produced the same error
Slimshaneey

OK, have you enabled fastcgi.impersonate in PHP.ini?

It may be worth going through the whole install procedure again. This time, download the non-thread safe version (its recommended by PHP for IIS).

Follow the steps in this and it may get you sorted.

http://php.net/manual/en/install.windows.iis6.php
pepps11976

ASKER
ok i will try and do this again

ill post back in a bit
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Slimshaneey

Also, just as a side, find where your php.ini file is, and make a copy of it, calling it php-cgi-fcgi.ini. Restart IIS and try again.
pepps11976

ASKER
ok done that something different now when i browse to phpinfo.php i get this

PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in E:\Websites\ftproot\localuser\john.pepper\www\DDA\phpinfo.php on line 1
Slimshaneey

OK, thats good, thats a PHP warning (Not an error) not an IIS one, which means your PHP is being interpreted now. Is it outputting the phpinfo(); text?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Slimshaneey

To solve that issue with timezone, just set the timezone in php.ini to whatever you need
pepps11976

ASKER
ok can you give me an example sorry im new to this can you guide me :)
Slimshaneey

Whats your Timezone? Are you UK or US or somewhere else?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Slimshaneey

As an example, my own entry in php.ini would would look like

date.timezone = "Europe/London"
pepps11976

ASKER
ok something strange going on now i have not done anthing yet just went to check all was ok again and now when i browse to phpinfo.php i get



The website cannot display the page
 


 HTTP 500
 


 


Most likely causes:
•The website is under maintenance.
•The website has a programming error.
 


 


What you can try:
 


 







Refresh the page.

 


 







Go back to the previous page.

 
John
Slimshaneey

Can you post the exact code in your php page?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
pepps11976

ASKER
<?php phpinfo(); ?>
Slimshaneey

Can you replace it with this, just to see if its an error reporting issue here;

<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
echo phpinfo();

?>
pepps11976

ASKER
but oddly enough this php works

http://www.lovemybookkeeping.co.uk/installation/

the above is looking at index.php

however if you browse

http://www.lovemybookkeeping.co.uk/phpinfo.php

it does not work
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Slimshaneey

After you made the changes to php.ini did you restart IIS? You need to do that every time. Im getting the timezone error when I visit the phpinfo page
pepps11976

ASKER
ok changed the code still the same error you can check with the above URLs if you want to
pepps11976

ASKER
ok just restarted iis
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Slimshaneey

Also, as per your installation warning, you need to make the install directory for the web app writeable to IUSR_<=machinename>
Slimshaneey

Have you changed the timezone setting? Im still getting the same error?
pepps11976

ASKER
Yes just checked that all is ok for permissions

what do you get when you browse to

www.lovemybookkeeping.co.uk/phpinfo.php
?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
pepps11976

ASKER
php.ini

i have attached my php.ini i think i added the timezone right
Slimshaneey

I get the following:

PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\Inetpub\Wwwroot\Joomla\phpinfo.php on line 4
pepps11976

ASKER
i wonder why i am getting something different
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Slimshaneey

OK, there is a line in you ini file, change the
display_errors = off

to

display_errors = on
pepps11976

ASKER
ok i have changed that and restarted iis
ASKER CERTIFIED SOLUTION
Slimshaneey

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
pepps11976

ASKER
Brilliant thats done it :)

Would you be able to tell me how to enable MYSQL within the php or shall i ask another question?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Slimshaneey

Looks like its working now! Its probably a good idea to turn back off the display_error directive when you are finished installing your site. Leave it on for now though!
Slimshaneey

Just uncomment the mysqli extension on this line:

;extension=php_mysqli.dll

Done, mysql support should be enabled!
pepps11976

ASKER
ok i will award the point and thanks for you help

just quickly if you browse to this page

http://www.lovemybookkeeping.co.uk/installation/

these are requirements for a joomla addon and as you can see MYSQL Support is in red although i have just enabled it like you said above do you know of any reason why this might be, Obviously i have mysql installed

john
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
pepps11976

ASKER
i think i read somewhere that in th php.ini file you have to tell it the default install directory for mysql, which in my case is c:\sql

do you think that could be it?
Slimshaneey

It may be that you havent added the correct folder for PHP extensions. F This is from the PHP site:

MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext
Slimshaneey

First off, you need to uncomment this line:

; extension_dir = "ext"

See if that sorts this issue, else you need to find libmysql.dll and stick its location in there
Your help has saved me hundreds of hours of internet surfing.
fblack61
pepps11976

ASKER
Ok I do have and extension directory

which is c:\php\ext

but that was already included in the zip file
Slimshaneey

Great, just uncomment that line then and you should be set :-)
pepps11976

ASKER
Thats done it you are a Star :)))
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Slimshaneey

No problem!