I've been hearing about HHVM for a while now, and when I knew Openshift was offering it as a free option, I decided to check it out.
However, it doesn't seem like my virtual machine is properly recognizing or serving either .hh files or files containing the hh start tag (hack files). I'm assuming this is a configuration problem, but I don't have much system set-up expertise and I'm not sure how to fix it.
If I try to run phpinfo() I just get back the one-word HipHop which I assume is for security. That suggests that the HHVM is actually serving the PHP file, but in that case, I don't know why the hh tag is not working (the code I tried to serve was ultra simple: < ? hh echo "hello"; ?>).
Openshift's VM runs nginx and HHVM, but the configuration seems to be a little different than that suggested for those installing their own.
I discovered the problem --it's very simple, but I'm posting the answer in case it might help others with the same problem.
In php, you typically open each file with < ? php and close it with ?>
In hack, the file opens with < ? hh, but you CANNOT use a close tag at the end.
Related
There's a bug in Virtualbox that results in small, static files not being transmitted over shared-folders properly. This purported solution is to add "sendfile off;" to the server/location block in Nginx (or a corresponding fix to Apache/etc...) and reloading. This prevents gibberish from being received in your Javascript, CSS, etc..
However, it's not working for me. I'm definitely hitting the right server/location blocks, but, even after reconstructing the Vagrant instance (with the Virtualbox provider), I still get gibberish in my files.
Does anyone have any guesses at what could be going on?
Yes but this can not be solved, you should create a real share on the Host and net use to that share, VB shared folders are a cheap way to get stuff in a VM but don't use it for anything else.
So I've recently setup a LEMP server and have managed to work may way through some of the configurations. I'm now to the point where I can begin writing php scripts and building basic pages. Looking at the php5-fpm wiki there aren't any pages discussing any changes I should expect as far as php scripts and such are concerned, only installation/configuration settings.
Is everything beyond the installation/configurations steps business as usual? From the point of view of a php developer what changes should I expect/make? How can best take advantage of the fpm version (in the php code, not module/system configurations)? I'm focused on comparing well-written php in both cases.
When I made the switch myself, I got to know a few perks about this kind of setup, such as APC file upload progress does not work out of the box (and you're better off using something else, such as nginx-progress-upload and/or JS File API); Some header names might have changed (prepending HTTP_); and a new and very useful function called fastcgi_finish_request.
For more information, though, look around the PHP-FPM Manual.
Only major gotcha I can think of is that some functions in the pcntl extensions, such as pcntl_fork, are not supported when running under FPM. (However, they're not supported under mod_php either, so this shouldn't come as too much of a surprise.)
I currently have apc installed and running under php-fpm. The apc info page reflects user cache entries but the file cache reflects 0 files cached. Other similar threads state that if runnning under FCGI, apc will not share the cache between the worker processes, and recommend using php-fpm. I share the symtoms with these people, however I am already using php-fpm and it is running fine. If anyone has any idea here, would be greatly appriciated. Been stuck on it at work for a couple hours now. I have another box set up where it is working and I believe I followed the same procedure, and both boxes are identical. Not sure where I could have gone wrong. I would be happy to provide more information. Thanks.
Update : When compiling APC with debug, I get file too big errors with every file. This is not the case on the working box. Looking through the source, I found the relevant snippet -
if(APCG(max_file_size) < fileinfo->st_buf.sb.st_size) {
apc_debug("File is too big %s (%d - %ld) - bailing\n" TSRMLS_CC, filename,t,fileinfo->st_buf.sb.st_size);
goto cleanup;
}
It has the correct filesize in the fileinfo strut, so I'm imagining that max_file_size is messed up. I'm going to try and track this down. Anyone have any idea? This is working fine on 64 bit Ubuntu outside of EC2, with identical configuration and files.
All the build tests from source are failing and hardcoding that value in doesn't help, it still doesn't cache.
First off, I will acknowledge that I am aware of another similar thread on the topic of wkhtmltopdf, but it was not similar enough to resolve my issue. Here's the other thread: wkhtmltopdf
Second, I will say that I have successfully used wkhtmltopdf with a Drupal site on a dedicated server that I run, where I installed the libX11 and used the most recent static version of wkhtmltopdf. That's on a CentOS 5 system and it runs nicely.
So, I have another hosting arrangement and I need to get the wkhtmltopdf to work, because it does the most amazing job producing bookmarked PDFs. The PDFs are beautiful.
The hosting is cPanel. I determined that it is on a server that has CentOS 5.5. It is not a problem to drop the static wkhtmltopdf in the print module's lib folder. However, I get the following message back in the Drupal admin status reports page (admin/reports/status).
It says,
"wkhtmltopdf library
The currently selected version of wkhtmltopdf () is not supported. Please update to a newer version."
I have obtained all of the needed .so files for CentOS 5, based on what jockie provided in his answer in the other StackOverflow thread.
Can someone knowledgeable confirm that his list was complete?
The idea of a shell script wrapper seems interesting and appears could be done for Drupal, if the naming of the shell script is called something like "wkhtmltopdf-wrapper.sh".
I have tried to use the shell script code that jockie provided, in a shell script. I did place all of the .so files in a sub-folder called "lib". I confess that I do not know what such things mean, in the script:
export HOME="$PWD"
Can someone interpret for me, what $PWD means?
export LD_LIBRARY_PATH="$PWD/lib/"
I understand that the script is going to get the .so files with that line, yes?
And can someone interpret the following line:
exec $# 2>/dev/null
What I am wondering is, where does the actual pdf get output? I did run the script. It did not throw any errors. However, I did not see a resulting PDF file.
Also, jockie's directions are not totally clear or defined enough. He says, "(some of them are symlinks)" under the list of .so files. Are such lines (in his list), the symlinks?:
lib/libX11.so.6 lib/libX11.so.6.2.0
Or am I mistaken? I was able to get all of them, so I don't know why they would be symlinks. The only thing is, that some of the versions are different. Do I need to delete the following files and make symlinks instead?:
lib/libX11.so.6
lib/libXau.so.6
lib/libxcb.so.1
lib/libXext.so.6
Should the shell script code be written differently, with Drupal in mind?
Thanks for reading and I hope someone can help!
...Finally, if anyone knows of a better solution, please share! Again, I appreciate the help!
...There does not seem to be a way, here on StackOverflow.com to notify jockie to check out this thread. I wish there was a way to write to them or notify them, so that they could clarify for them-self or contribute to this thread as well. If someone knows of a way, please let me know that too!
I asked a previous question here but after reading the answers realised I hadn't done a very good job of defining my requirements.
Here's what I'm after:
Cross platform
Drag, drop and start
Preferably a single file
So to sum up I want something that I can just drag into a folder, start up and then it will start servering over http the contents of that folder.
Hope someone knows of something.
Cheers,
Chris
Python implementation:
#!/usr/bin/env python
import SimpleHTTPServer, BaseHTTPServer
def launchServer(ports):
for port in ports:
try:
serv = BaseHTTPServer.HTTPServer(('', port), SimpleHTTPServer.SimpleHTTPRequestHandler)
except:
continue
else:
print ("Launched on port " + str(port))
serv.serve_forever()
raise Exception("No ports available")
launchServer([80] + range(8000, 9000))
For a Windows executable, run this:
python setup.py py2exe
setup.py:
from distutils.core import setup
import py2exe
setup(console=['minipywebd.py'])
On Linux, chmod a+x the python file.
I have found a some-what small web server in the form of a Firefox addon. It works on any platform that Firefox works on. It can be installed very quickly and can be ready to use in around 45 seconds (I timed myself from the time I started downloading to the time I served my first page). The server sets up a directory for you to use right after it is installed so you could just drag it there and start viewing the page instantly. It also has limited server-side scripting capabilities(SJS) included but can be extended with common languages such as php and Perl. I don't think this would be the server you would use to host Google but it seems to be what you're looking for.
The download is here
Well it is quite late to answer this one: but python afaik is not single file ;-)
TCL is!
Look at www.equi4.com for a tclkit or starkit. TCL can implement an HTTP server easily. But with a TCL starkit you can even pack the content to be served into the very same file as the webserver and the TCL interpreter and possibly extension.
Building a complete solution is no rocket science but you will have to read yourself into the thing a bit. TCL can be learned in two to three hours if you ever programmed anything before.