PHP extension loading from script using dl() - php-5.3

I'm going to buy a (cheap) hosting space with apache/php 5/mysql. Because it's cheap i have no direct control over php.ini and extension loading.
My question is: can i load an extension putting the .dll file into my space and than using dl() php function? Can the host disable this feature thus avoid loading custom extension this way?

Yes, it can be disabled through the enable_dl and safe_mode php.ini settings (which would almost certainly be the case, as otherwise you could e.g. load your own code in the web server process).
And that's in addition to the disable_functions setting, which can disable anything.

the host can disable any function within php from the php.ini. in fact I would be surprised if the host left this feature on.

Since you're talking about a .dll, you are assuming to get a Windows hosting server running PHP, however, is better that you check with the hosting company, because probably dl() will be disabled.
Smaller hosting companies can be more accommodating with adding extensions you may require.

Related

Map a file in Docker using Docker Volume [duplicate]

change a config.properties file in a jar / war file in runtime and hotdeploy the changes ?
my requirement is something as follows, we have a "config.properties" in a jar/war file , i have to open the file through a webpage and after the user has made necessary changes to it, i have to update the "config.properties" in jar/war file and hot deploy it. can we achieve this feat ? if so can you please point me to relevant sites/documents so that i can jumpstart on this.
I will strongly recommend your architecht rethink this solution. What you describe should be done through JNDI or a similar technique, not through reloading properties.
Deployments should be considered static - that any given web container allows for magic trickery should not be depended on, and WILL break some day (most likely at the most inconvenient time).
You've got a couple of problems off the top of my head:
ensuring that nothing is holding static references to a java.util.Properties that has previously loaded your config.properties file.
most servlet engines will unpack your war to a working directory so the properties file you load won't be the one in the war, it will be the unpacked one. This means your changes
will be overwritten when you restart the servlet engine because this is typically one of the points the war is unpacked.
While these problems aren't insurmountable I've always found it much easier to implement this sort of behavior by storing the properties in JNDI (as Thorbjørn suggests) or a database (while being careful about the static references I mentioned in point 1).
The JNDI/database solution has the nice side effect of easing deployment into multiple environments because each typically has it's own registry/database.
Even that I agree with the comments explained before, I could suggest one solution:
Apache Commons Configuration extension gives you the posibility to do something like:
config.setReloadingStrategy(new FileChangedReloadingStrategy());
That could make the trick to change the configuration file on a runtime basis with no code at all.
However, like JNDI and other methods of web application configuration, the security is a concern. Be careful on which parameters you can/must be able to configure.

How do I make a simple public read-only WebDAV server with SabreDAV?

I recently began looking into WebDAV, as I found it to be an option for letting me play a Blu-ray folder remotely - i.e. without requiring the viewer to download the whole 24gb ISO first.
Add a WebDAV source in Kodi v18 to a Blu-ray folder - and it actually plays! Very awesome.
The server can also be mounted on Windows with
net use m: http://example.com/webdavfolder/
or in Linux with
sudo mount -t davfs http://example.com/webdavfolder/ /mnt/mywebdav
-and should then (in theory) play with any software media players that supports Blu-ray Disc Java (BD-J), such as PowerDVD and VLC.
vlc bluray:///mnt/mywebdav --bluray-menu
PowerDVD.exe AUTOPLAY BD m:
(Unless of course time-out values has been set too low, which seems to be the case for VLC at the moment).
Anyway, all this is great, except I can't figure out how to make my WebDAV server read-only. Currently anyone can delete files as they wish, and that's of course not optimal.
So far I've only experimented with SabreDAV, because afaik that's the only option I have if I want to keep using my existing webhost. Trying with very minimal setups, because I've read that minimal setups should default to a read-only solution. It just doesn't seem to happen.
I initially used the setup from http://sabre.io/dav/gettingstarted/ and tried removing some lines. Also tried calling chmod 0444 MainFolder -R on the webserver. And I can see that everything does get a read-only attribute. But it changes nothing. It's still possible to delete whatever I want. :-(
What am I missing?
Maybe I'm using the wrong technology for what I want to do? Is there some other/better way of offering a Blu-ray folder for remote viewing? (One that includes the whole experience - i.e. full Java menus etc).
I should probably mention that all of this is of course perfectly legal. It is my own Blu-ray project - not copyright material.
Also: Difficult to decide if this belongs on StackOverflow or SuperUser. I ended up posting it on StackOverflow because SabreDAV is about coding, and because there's no sabredav tag on SuperUser.
You have two options:
Create your own file/directory classes for sabre/dav that simply throw an error when trying to delete. You can basically start with a copy of Sabre\DAV\FS\Directory and Sabre\DAV\FS\File and change the methods that do writing.
Since you're considering just using linux file permissions, really the key thing you are missing is that that 'deleting' is not controlled on the file or directory you're trying to delete. To delete a file or directory in unix, all you need is write permissions on the parent directory. However, I wouldn't recommend going this route as doing this will just cause a weird error in sabre/dav, which might leave clients in a confused state. It would result in a 500 error, not the expected 403 error.

Dartium and it's use of dart:io

I am building a feature-rich standalone application using dart. I picked dart since it seemed to allow not only the standard development approach for webapps but also to access system resources (such as nodejs does). One of my requirements is file io or database access (which again requires file io). Dartium however does not allow the use of the dart:io package (only in servermode is this library accessible). Can anybody think of a workaround, a change to the dart environment or the chromium environment to allow this ? Maybe a custom compiled dartVM in the browser environemnt.
Basically a way to use database connections in a dart standalone app. A REST wrapper is only an option if this code could get generated automatically.
I am not clear if such a thing is possible or if chromium will prevent any approach to access system resources.
Yes in standalone mode dart you can use files, and also TCP socket, and web socket.
So you can connect to databases. (for example to MySQL: https://github.com/jamesots/sqljocky)
In browser mode you can use built-in databases dart:indexed_db or dart:web_sql.
You can also use web-socket protocol
Maybe you can use websocket to connect with local or remote database.

JBoss newbie can't load app to custom port

Thanks in advance for your patience. I'm a recent "convert" to JBoss, having the maintenance of an application thrust upon me, and so long as we don't touch it, it works just fine. However, the mandate has come down to port the app from Solaris to Linux Fedora, using version 4.2.3GA.
I am using the jboss-port-bindings.xml to specify the ports I want to use, but when I bring JBoss up it loads to standard port 8080 rather than 40029 like I specify in the file. I have triple-checked the configuration and it's set up on the Linux box exactly the way it's set up on the Solaris box - all the required files are where they are supposed to be, etc.
Anybody have an idea as to why I can't use the specified ports? If you need more information than what I have supplied, please just ask.
We found the problem. The jboss-service.xml file we had in the server/default/conf folder was correct, but we also needed to add the same file to the server/appname/config file, where appname is the name of our application. This told the app where to go looking for the jboss-port-bindings.xml file and now everybody's happy.
Don't know why we didn't have to have that configuration under Solaris, but anyway, this solved the problem. Thanks to those who had a look at the question. Chalk this one up to experience.

JavaFX url-proxy?

My computer is running behind proxy. I want to access url from JavaFX. for example say i want to show image from a url. But i haven't seen anyway to provide proxy settings for the connection(?). Please if someone can tell me how to do things in such situation?
Thanks
As link in accepted answer doesn't work anymore I'm adding proxy setting code here:
System.setProperty("http.proxyHost", "myproxyhost");
System.setProperty("http.proxyPort", "80");
By default, JavaFX will automatically use your Operating Systems proxy settings, this is controlled via the Java Preferences or Java Control panel icons on your Mac or PC.
You can also set, within Java, the proxy environment variables, but I haven't tried this.
If you are trying to request an external resource from an unsigned application, Java may prompt you (the user) for permission when it runs.
Setting proxy in Java/FX

Resources