0

I manage a server on linux that has apache with php and suphp. Like most setups, all program files are currently stored on disk.

I want to run suphp from ram. I then copied everything in the suphp folder (config files, folders, and program totaling about 2.8MB) to ram. Then on disk, I renamed the folder so the old version doesn't get accessed. I used the -a switch with cp to preserve the permissions and such.

I then made two attempts which both led to failure.

First, I make a link (using ln -s) named suphp that points to the suphp folder in ram. Then when I browsed the file/folder structure, everything else looks identical as if the setup was ready to work.

Since that didn't work, I made another attempt by removing the suphp symbolic link, then creating an empty suphp folder and mount-binding it (using mount --bind) to the suphp folder in ram. That did not even work.

I then looked at my apache error_log, and during the time I tried this steps and until I restored the original setup, I received various error messages with the text similar to this in common in all of them:

"(2)No such file or directory: couldn't create child process: (suphp folder location)/sbin/suphp for (full path to php file on website)".

What baffles me is, why would it report no such file or directory instead of some other error...

1 Answers1

0

suPHP will be loaded into RAM by Apache since it is an Apache module (mod_suPHP). There is no reason to move the actual files/executables to the system's "ram" directory and set up symlinks like you have done.

If your intent is to keep PHP scripts in memory, consider using an opcache like the one built into 5.5 or apc, see How to use PHP OPCache?

Community
  • 1
  • 1
zamnuts
  • 9,492
  • 3
  • 39
  • 46
  • I actually implemented page-caching for the frequently accessed sections of my site and those pages have a TTFB (time to first byte) of between 100 and 200ms. Before the caching was on, their TTFB was between 400 and 600ms. The reason why I wanted to move it into ram is because suphp executable is invoked every time someone access the php script, and that happens at least a few hundred times a day. –  Jul 22 '14 at 02:37