I have written web apps with JSP in the past. Now, I'm getting started with PHP. I have a question and a friend of mine who is a .NET developer pointed me to this site.
I downloaded and installed PHP from here. Now, I'm trying to get the Windows Azure for PHP SDKs setup. The reason for this is that my app needs to be hosted in Azure. After I downloaded the SDK, I looked in the install.txt file. The file states that I need to add the library directory to my PHP include_path. My problem is, I do not see an environment variable named "include_path" in my settings. Should one have been created? Is the PHP include_path even an environment variable? Can someone help me out please?
Thank you!
include_path is a configuration setting usually set in the php.ini file.
Run a PHP script containing
<?php phpinfo(); ?>
to find out which php.ini is actually being used - it can be confusing sometimes.
The INI file will contain the setting, which you can then change.
You will probably need to restart the web server after changes.
I don't know how PHP and Azure work together. If the INI method doesn't apply here, here is the PHP manual section on ways to change PHP config settings other than php.ini.
I would go with a dedicated development system like XAMPP. Although it should be noted that XAMPP should NEVER be used on a production system. It is very insecure and they are very very very slow at patching known vulnerabilities in their stack.
Question: If you're planning on building an Azure based system, why are you choosing to build it in PHP rather than C# on ASP.NET?
.NET is Microsoft's primary platform for web infrastructure development: Azure support will come quicker and will be FAR more thorough for .NET vs. any other platform.
Remember: "Just because you can doesn't mean you should" ;)
I strongly encourage you to build your Azure site in .NET, not PHP.
Related
Previously I used shared hosting, and the hosting company provided Apache Tomcat with PHP and MySQL. I have since switched to virtual private server hosting with Linux, so I can use a server of my choice, in particular Glassfish 4.1.1 for Java ServerFaces 2.2 applications, and have already deployed a war file for a particular application.
However, I have quite a lot of old code, including some PHP. I have put my old code in Glassfish's docroot folder and all the straight HTML5, JavaScript etc. work without any problems. How do I get the PHP code to work as before? In doing a Google search, it appears possible to deploy a war file from Quercus, but if this is done, how do I get PHP to work in the docroot folder?
I'm not aware of anybody who has done this before, so any advice would be most appreciated - thanks in advance.
I used GlassFish before with JSP. Now PHP has become the language of my choice. I feel like it's much more maintainable.
But to answer your question, in order to get PHP to work in the docroot server, you have to enable PHP on OracleGlassFish Server. From Oracle documentation :
1. Download the Quercus PHP interpreter from http://quercus.caucho.com/.
2. Deploy the downloaded WAR file to the GlassFish Server.
3. To verify that your PHP engine is working, enter the following URL in your browser:
http://localhost:8080/quercus-4.0.1/
4. Move your PHP application to a subdirectory of the Quercus directory.
5. To verify your PHP application is working, access your application from a browser.
For example, enter the following URL in your browser:
http://localhost:8080/quercus-4.0.1/myapp/
Also, this previous answer from SO may also help :
Allow Glassfish and PHP to work together in the same server using Apache
I am a little bit confused about the fact that PHP can only use DLL files for a DOTNET object from the Global Assembly Cache and not from a local folder (from what I know). How is your site, that's using a DLL, going to work, when your web server doesn't have such a GAC? Right now I am developing on my local machine; No problem, but I am worried if I will be able to run my site elsewhere.
So my question is: Is it possible to access a DLL from another location than the GAC?
I have seen quite a lot questions/answers already, but all of them were relating to ASP.NET and how to use DLLs in Visual Studio.
Thanks in advance
-Snrk
EDIT: I could describe what I want as a "LAC" (Local Assembly Cache).
I am strictly a LAMP dev but an ad agency I work with is courting a government agency whose RFP requires that their site be delivered via a Windows server.
What advice do folks have on this? Are there specific pitfalls? It seems like I have heard that file uploads and folder permissions are very different on Windows servers.
Any advice would be greatly appreciated.
IME, IIS can behave very oddly at times.
The permissions model is primarily ACL based - so its certainly possible to design a system which mimics the way Unix works - but (just as with Unix) get the permissions model right - and don't tinker with permissions / ownership in your code.
And of course you'll get yourself tied in knots if you try to move up directory hierarchies and cross over 'drives'.
Add to that a complete absence of the services you might invoke via popen(), and the POSIX tools.
Yes, people keep telling me its a nice place to visit but I wouldn't want to live there.
OTOH, a self-contained set of PHP files will run quite happily there.
PHP on a windows server is definitely trying on your patience. Problems that I've run into are making sure that IIS is configured to use the correct php.ini file, and as you said, writing to files on the server as well as folder permissions.
That being said, if you can get it working correctly, it's not a bad production environment.
I would suggest getting your dev environment as similar as possible to what production will look like. That way you run into as few problems as possible when you deploy.
I can see some pitfalls for using PHP on IIS
Since IIS is multithreaded unlike
linux which is multiprocess. Some
PHP scripts might be unsafe.
Because of this PHP should be installed and
run as a CGI extension. CGI is
slower than IIS's ISAPI and worse
when compared to Apache's mod_php.
Another pitfall I can think of is URL rewriting. IIS, versions below
v7 do not support url rewriting.
Configuration of PHP with IIS is really a pain. But when you do configure it, make sure you use the same configuration, exact mirror images everywhere you are developing because a lot can go wrong with just one glitch.
I am asp.net developer , i want to learn php
what are the software need to run compile php file ?
how to install this software any path that should be set ?
what kind of database it needs to store data and retrieve date ?
see me as beginner and then give the idea / information ..........
thanxx
You just need the PHP interpreter and if you want to do web stuff a webserver.
You can get the interpreter from http://www.php.net - if you are using windows you really want to get a binary version and not compile it on your own - and the Apache webserver.
As a database PHP developers usually use MySQL (but it can also connect to most other databases).
The easiest way for your to get started is getting a package like XAMPP which will contain all you need without requiring you to configure everything manually.
For actually learning PHP, please get a recent book/tutorial. Old stuff is usually telling people to do horribly things every sane developer will hate you for (cluttering your global namespace with variables settable by the user for example).
You could have a look at the official PHP docs which also contains a "getting started" guide.
Since you are an ASP.NET developer I assume that you are familiar with IIS and that you're probably using IIS 7.5. If so then the easiest way to familiarize yourself with PHP is to use Microsoft Web Platform Installer and install PHP directly to IIS. You don't have to set any paths after that, just create a site on IIS and start putting PHP files there. Keep in mind that Web Platform Installer automatically enables WinCache extension and your changes might not be there when you hit the refresh button. Just locate the php.ini and comment out the relevant line.
Straight from the horses mouth. Getting Started. You will need a php interpreter, if you have access to a webhost that has php installed you're half way there, if you have a linux partition you're half way there, otherwise check out XAMPP.
Software: XAMPP will get you up and running
Tutorial: w3schools
If you are familiar with IIS and want to use it as your web server you can download PHP for IIS here and use some of the learning material there to get started.
If you did not want to use IIS and wanted to use Apache instead then I agree with the others XAMPP will get you a dev environment up and running quickly.
I'd like to develop a PHP application that users would download and then could run. The application will have a web service.
I assume they will need Apache, but my main question is what is needed for PHP to run on their machine? Is there something needed like the JVM in Java or the .Net framework in .Net? What is it called and how difficult is it for them to download (size, etc.).
Is anything else required that I did not mention?
Thank you,
They will need a web server with a compatible version of php. That's it.
Are you asking what is required to run a .php file on a windows machine? Do you mean like an executable or a web server script?
If like an executable need the php files:
Download the php installer from http://windows.php.net/download/, and then you can run php.exe script.php
If like a web site:
You need a webserver (like apache) and the php.exe files. I would suggest if testing to download a prebuilt webserver like XAMPP (download from http://www.apachefriends.org/en/xampp-windows.html)
It depends on the application. At a minimum it will need PHP.
Is there something needed like the JVM in Java or the .Net framework in .Net? What is it called and how difficult is it for them to download (size, etc.).
PHP. Presumably as difficult as it is for you, but it depends on the platform. OS X comes with it. Most Linux variants either come with it, or allow it to be installed with one command to the package manager. Windows users will have to download it seperately.
As for other things that might be needed…
If it has a GUI, it might need PHP-GTK.
If it expects to be accessed via HTTP then they will need a webserver which supports PHP. This could be Apache, IIS, or one of numerous other servers.
(It isn't clear if, when you say "The application will have a web service.", you mean "The application will access a web service" or "The application will provide a web service". If the latter, then a web server will be needed).
If you use any non-core modules, then they will be needed as well.
You need to describe your proposed application a bit better. Is there a reason the application must be in PHP? It may be possible, but it's certainly not common to code and distribute a desktop application written in PHP.
There are a few options.
If you are just writing a script (command line, etc) you don't need a webserver. You just need PHP installed to run it (there are even downloadable installers for it).
If you are writing a web-based tool, then you will need your users to have a webserver if they are meant to run it on their physical machines. And you don't need a framework...
just think of it as a Webserver + PHP as a plugin. Some webserver options: Apache, nginx, lighttpd
Try having users install WAMP, MAMP, or Zend Server CE all of which are free and come with both a webserver and PHP.
If you really want a deployable PHP script/tool, maybe look into something like PHPDock, which gives your users a single installable app (embedded server, php). NuSphere PHPDock
Honestly, it's not the greatest language to use for this type of deployment, but it's certainly fun to try to figure out! Sorry for not linking out also, don't have enough rep points for all of the links I had intended to supply.
Actually you can run php script without the need to have a webserver installed.
Just install php and then from command line:
$ php myscript.php
If you really want you can even build GUI application with php even though I would not suggest it.
Cheers Andrea
you could also try to use quercus.
Quercus is Caucho Technology's fast,
open-source, 100% Java implementation
of the PHP language (requires JDK
1.5).
This way you only will need a jvm+quercus. It also is platform independent this way because it runs in the JVM.