Enable PHP's POSIX functions on Rackspace Cloud Sites - php

I use Rackspace Cloud Sites for web hosting. I was trying to use a couple of the posix_* functions and noticed that they aren't available. Using phpinfo() I was able to see that --disable-posix is part of the "Configure Command". Also, the disable_functions directive has this string leak,posix_getpwuid,posix_getpwnam,posix_getgrid,posix_getgrnam,posix_getgroups.
Is there a way to override this using .htaccess? I didn't see any mention of it in the manual.

Configure commands like --disable-posix are part of the compilation process.
Unless they let you compile and run your own build of PHP (I'm not familiar with RackSpace Cloud), you can't change that.

No. They are disabled for a reason. That's the price you pay for using Rackspace Cloud Sites. If you need to enable stuff and change configuration settings beyond what .htaccess allows you to do, you'll need to setup a Rackspace Cloud Server for your web hosting (which is not managed by Rackspace b.t.w.)
Edit: Though I should clarify what I meant by "not managed by Rackspace"... They manage the hardware, but not the software that goes on your server. That's completely up to you.

Related

Developing a PHP/mySQL app on IIs

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.

ASP.NET and PHP in same Website

I would like to have an asp.net website hosted in IIS at site like this
www.mydotnetsite.com
and then have a wordpress blog that is an application to it...
www.mydotnetsite.com/wordpressblogsite/
Is this possible?
Yes, it will be not a problem. Even some Windows Shared Hosts offer PHP plans - Windows Hosting PHP.
You can configure IIS to support both Asp.Net and PHP at the same time.
yes,you can host your php website in IIS
Yes it is possible! You can install wordpress in a subdirectory.
You need to have PHP/MySql configured in your IIS. (Here is how)
You need to point www.mydotnetsite.com/wordpressblogsite/ to the wordpress folder (Download the latest from wordpress.org). In most of the cases, simply copying the folder with the desired name(wordpressblogsite) within the document root of webserver is enough.
You can then go to the URL and follow the installation option (recommended) OR you can edit the wp-config.php file to put the db credentials etc.
The short answer: Yes.
The long answer:
First you're going to have to make sure that PHP and MySQL are installed and working properly on your server and configured for use with IIS. There are installers available to make this process easy. Check out http://php.iis.net/. That will help out a lot with getting PHP up and running as well as installing wordpress. MySQL should be easy too, just check out their site and install the correct package.

Starting Dev with PHP on Windows

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.

XML-RPC with PHP and GoDaddy? Confusion sets in

I am attempting to work with XML-RPC via PHP on a GoDaddy server.
This same server is hosting a Wordpress Blog that makes use of XML-RPC and is functioning, though that may be unrelated...
Whenever I attempt to use any functions that are integrated into PHP for use with XML-RPC, I get an error (function list here: http://us3.php.net/manual/en/ref.xmlrpc.php) e.g.:
Fatal error: Class 'xmlrpc_client' not found
Is this because XML-RPC's PHP functions are not enabled on my server? If so, how do I go about enabling those - it would seem I would have to install the XML-RPC library to do so and of course I cannot do that on a shared server. Doesn't Wordpress use the same batch of XML-RPC functions though (it works fine)?
I think I have managed to thoroughly confuse myself. I have zero experience with XML-RPC.
The first point you made regarding the same server hosting a site supporting XML-RPC, is quite odd, as XML-RPC is enabled at compile time. There are no directives to be used in the php.ini file, and you therefore couldn't enable XML-RPC at run time using ini_set(). This would point to either a different server or several PHP instances running on the same server.
Either way you need to have this extension enabled at compile time, which is out of your hands. So you would have to contact somebody at GoDaddy to get this working.
An alternative to that, would be to look at something like Zend_XmlRpc which is well supported and doesn't require the PHP XML-RPC extension to work.
Good luck.

Solving the shared-server security problem for Python

So my group is trying to set up a shared-server environment for various and sundry web services. I think we've settled on setting disable_functions and disable_classes site wide in php.ini and php_admin_value to force open_basedir in each app's httpd.conf
for php scripts, and passenger's user switching for ruby scripts.
We still need to find something for python though. Passenger does support python, but not for per-application security for specific sub-directories (it's all or nothing at the domain level).
Any suggestions?
(And if any of the previous doesn't make sense - well, I'm the guy who's supposed to set up the python support, not the guy who set up the php or ruby support, so there's still some "and then some magic happens" steps in there from my perspective).
Well, there is a system called virtualenv which allows you to run Python in a sort of safe environment, and configure/load/shutdown these environments on the fly. I don't know much about it, but you should take a serious look into it; here is the description from its web page (just Google it and you'll find it):
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded.
Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application.
Also, what if you can't install packages into the global site-packages directory? For instance, on a shared host.
In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't use the globally installed libraries either).

Categories