PHP 5.3 - getting it to run on Apache server? - php

I've set up my own Apache server; with MySQL, PHP and PHPMyadmin.
It used to work previously when I did it before on various computers; but that was the older versions I dealt with, not the latest. However, it's been a while since I've updated my PHP version, so that's why I'm asking this.
What configuration changes do I need to make to get 5.36 to work properly with Apache?
Currently any .htm files can display properly in http://localhost, but no .php ones.
All I see is a text file, so what's gone wrong with this?
The server is not public - in fact, it's on a Windows Vista Home Edition install, and it's a development one. I don't need to worry about anything else just yet, as this is a totally new install.
What config changes do I need to make?
I tried:
# mod_php5
Include conf/extra/suite-php5.conf
but that didn't work, so what's the solution with PHP 5.36?
Should I re-enable the above line (it's currently commented out with the # symbol).
So far the server works; but it's not serving up PHP pages, which is strange.
Anyone got any ideas why? I would gladly appreciate your help!
Won't post the httpd.conf since it's being developed right now though.

No more VC6 versions of PHP 5.3.x?
From the release announcement:
Windows users: please mind that we do no longer provide builds
created with Visual Studio C++ 6. It
is impossible to maintain a high
quality and safe build of PHP for
Windows using this unmaintained
compiler.
For Apache SAPIs (php5_apache2_2.dll), be sure that you
use a Visual Studio C++ 9 version of
Apache. We recommend the PHP builds as
provided by ApacheLounge. For any
other SAPI (CLI, FastCGI via mod_fcgi,
FastCGI with IIS or other FastCGI
capable server), everything works as
before. Third party extension
providers must rebuild their
extensions to make them compatible and
loadable with the Visual Studio C++9
builds that we no longer provide.

Check your config files for http and php. I haven't done this in a while, but you need to add the file type .php to list of files types that you want Apache to serve. READ the config file carefully.
Also, inside your http config file there should be some additional lines that tell Apache where to find php, vis-a-vis the php.ini file. You need to set up your path information inside the config file and in the environment/system variables section of your Microsoft OS.

Related

On Windows 8 and Internet Information Service 8.5 - how to setup PHP?

Let me begin by saying that I am very new to Microsoft's Internet Information Service. I need to setup IIS on my PC and it should also execute PHP files. So far I got everything installed and running - the latest PHP and enabled IIS service. I can view the Default Webpages (*.html) files ONLY. It will not execute PHP files. If I try to request any PHP files, I get 403 error.
I have been researching online and seems to be more confused about setting up PHP (extension) on IIS. Some websites say you need to configure PHP through its MANAGER. Others say I need to add Role and FastCGImodule through IIS manager. According to Microsoft I need to rename php.ini-development to php.ini and point php to some DLL file.
I am using Windows 8, IIS 8.5 and PHP 5.6. I hope someone could point me in the direction.
You can set this up manually or with the IIS Manager. I would set this up my own, so you know whats going on.
You will need to setup the CGI role feature. This includes FastCGI. Here is some information how to do that: http://www.iis.net/configreference/system.webserver/cgi
Then you will need the PHP package somewhere. Lets say in C:\PHP. You can change that if you want.
You will need the fastCGI settings. You can easily set this up by commandline:
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\php\php-cgi.exe',activityTimeout='1200',requestTimeout='1200',arguments='-c%20C:\php\php.ini']
This example uses a timeout of 20min.
This will set the handler:
%windir%\system32\inetsrv\appcmd set config /section:handlers /+[name='PHP_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='"C:\php\php-cgi.exe|-c%20C:\php\php.ini"',responseBufferLimit='0',resourceType='Either']
php.ini setup:
[cgi-fcgi]
fastcgi.impersonate=1
cgi.force_redirect=0
cgi.fix_pathinfo=1
For write access you will need to grant "modify" access for the the IURS.
More Information: http://php.net/manual/de/install.windows.iis7.php
I did try the answer posted to heart, but I kept running into problems. In fact, I also followed the Microsoft step by step PHP setup tutorial to the TEETH. I still couldn't get PHP working on my IIS. Although Microsoft warned against using Windows Platform Installer(WPI), I downloaded WPI and ran the installer. Under frameworks, I found PHP 5.6 and clicked on Add button. Then, clicked on the Install button. It took only about 30 seconds to install. Just to be sure. I checked IIS manager and there it was PHP Manager. After opening PHP manager I noticed that all the settings were there and enabled and it already had 15 different extension enabled. Plus, it also had about 35 extension disabled, but it gives you option to enable them right there.
Now, my PHP files are rendered as expected. I even did phpinfo(); and the browser displayed all the PHP settings and information. :)

multiple php installations

I am looking to see what it takes to have multiple installs of php in osx 10.5.
I found this page that goes on to explain it for windows.
I was looking for confirmation from someone that knows better than me, if the steps are very similar for 10.5.
I am a novice user. Having only scripted with php, not actually building or installing it.
My web host runs a php older than I have installed. And I'd like to at least test locally on a version the same as my remote option.
Any help is appreciated. Thanks.
Is one of the servers running PHP 5 and the other PHP 4?
If so you can run PHP 5 in PHP 4 mode by enabling the following in your php.ini file:
zend.ze1_compatibility_mode = 1
If you can't edit the php.ini file then you can't change the local version for the script running by adding the following to your PHP script:
#ini_set('zend.ze1_compatibility_mode', 1);
You should find a tutorial for Linux or BSD, which would be a lot more helpful then a Windows-based one.
Some time ago I managed to do it on WIndows and wrote a quick how-to. While I don't believe it could be much relevant to OS X (except maybe for the part showing how to switch engine in .htaccess) I can give you some hint about the basic points:
Install as CGI, not as an Apache module;
ignore any instruction to put your php.ini in a common location or set up environment variables pointing to a single php.ini: what you definitely need is a separate php.ini for each PHP version, so you have to put them in the respective PHP folder to be found;
when testing check with phpinfo() which php.ini is actually being loaded.
Just for sake of completeness I'd add that at the time of writing (2007) both PHP4 and PHP5 were happy to run with each other's php.ini - until I started loading extensions: those are compiled for their PHP version only and go into a spin if used with the wrong PHP.
Hope I've been helpful.

Best PHP download to keep all my options open?

In the past, I used WAMPserver on windows to parse PHP for me. This is a pre-configured package, focussed on working with MySQL.
When I tried to run PostgreSQL, I got error messages that said that my version of PHP wasn't compiled to work with PostgreSQL.
So, I've recently uninstalled WAMP and every associated with it. I've downloaded Apache 2.2.11 with openSSL, installed as admin(you know, run the command prompt as administrator, cd to the directory where the download was done and have it executed, so the install was done as admin).
That's that. I now have Apache installed, "it works" shows up, so I'm that far.
Now I'm wondering, do I download the exe and install, or the zip, or something else.
What is the best thing to do to make sure that the PHP on my system can handle everything I can ever throw at it?
Also, PHP first, or MySQL/Postgre first.
And lastly, what about PEAR? I need PEAR installed, which isn't standard on Windows. I'm guessing the pear.bat file in the PHP downloads will do that for me?
EDIT: I see one close vote, yet no comment as to why. It makes me wonder how people who are so lazy and rude got to have somany points.
I would recommend downloading the zip package, as configuring php is not really that difficult, and it allows you to add features as needed.
As for whether first to install php or MySQL/PostgreSQL, - it does not really matter. You can install them in any order.
Your guess regarding PEAR is quite correct
i haven't used wamp before, so i can't comment on that
i do however use xampp which sounds very similar
in xampp if i want to enable postgres support i edit the php.ini file and uncomment the postgres section of the ini file, same with any of the extensions that i need
perhaps this might be an alternative you can try if you get stuck
There are many ways to setup a HTTP server/PHP/database machine. Sometimes the behaviour of your development setup will differ from the live server's.
I would recommend finding out the setup your web host is using, then getting a vmware appliance image that fits that as close as possible and get any additional software using it's package manager (which is easier that installing stuff on Windows).
Setup a file sharing link between the VM and the host, make sure you can view the VM's port 80 in a browser running in your host OS and you're set.

Installing PHP, Apache 2.2.10 on Windows Vista

I am trying to get PHP working on my vista home machine but I am getting weird problems. First I had file permission problems for which I disabled Vista's UAC. Now I can't get the PHP interpreter working.
I have made all the necessary changes following some tutorial but I still can't get it working.
Tutorial was located here: http://www.tanguay.info/wamp/installPhp5.php5
Try XAMPP. I use that at home on a Vista machine and it worked nicely after the install.
WAMPServer is also a good option. You can easily enable/disable both PHP extensions and Apache 2 modules. Everything is set up somewhat securely (only local access to the serve), and you get phpMyAdmin already set up.
Only thing I've ever missed is Memcached, but that is fairly easy to set up on your own.
The only problem I have installing PHP and Apache on Vista is that you need to make sure that when you edit the httpd.conf that you are editing it as an admin, otherwise the file is saved in compatibility mode.
To overcome that problem just type notepad++ or whatever in your start menu, right click the item and run as administrator. Then open the file from the app.
You can use FastCGI for IIS 7. I'm using this also and it works perfectly!!
FastCGI
You can try Zend Core
It works on both IIS and Apache (it includes the installation of the Apache)
iis7 is one of the best web servers and especially for php, if you can't get it to work it means you need to google enough, because it isn't logical to blame Vista for php/apache issues

install php on server (iis6) when php already exists due to backup exec

I need to install or use php on a windows 2003 server that already has php 5.2.0.0 installed due (I think) to setting up symantec backup exec. I don't want to interfere with backup exec's php.ini settings - and would rather be able to control my own configuration of php.
searching for php shows that php.exe and other php files are currently installed in
c:\program files\symantec\backup exec\
I'm almost certain that installing the current version of php 5.2.8 to c:\php would be disastrous or calamitous in some way.
There is no PHPRC entry in the server properties > environment variables and I'm pretty sure that the php.exe location is not included in the PATH variable. ...unless the actuall install location is different from the c:\program files\symantec\backup exec\ dir.
Any suggestions on how to proceed?
I'm almost certain that installing the current version of php 5.2.8 to c:\php would be disastrous or calamitous in some way.
What makes you say that :) I've run separate PHP versions on the same machine side by side and not run into bother.
AFAIK the Symantec install should not conflict with your own installation, nor should the separate php.ini files conflict with each other.
[Response to comment]
First thing to note is that I have no experience of Backup Exec or what it uses PHP for. I'm guessing it uses it for its own internal stuff and doesn't spread itself over the OS. Test this by searching for php.ini and php DLLs on the file system. I'm betting it's all quite self contained. PHP searches for the config file as noted here: PHP Site . As you note, BE hasn't set the PHPRC variable. Check it hasn't used those Registry entries either. On a different tack, has BE installed an admin site already on IIS? If so, check the IIS Web Service Extensions to make sure it hasn't already registered the PHP ISAPI dll or PHP CGI exe. IF not, I think you should be okay for your new install.
To be on the safe side, do a manual PHP install as illustrated here: PHP Site. That way, you know exactly what you have installed, and can easily remove the files again if they cause a problem. I can't imagine a problem here that would require you to reinstall BE.

Categories