As a learning exercise I used Symfony to update an existing application for a local non-profit. Development was in a Windows environment. Now that the application has been installed on their ISP's shared host I start to learn about chroot on a FastCGI server. There are errors such as this:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"/home/projectmana/www2.projectmana.org/app/logs/prod.log" could not
be opened: failed to open stream: No such file or directory' in
/www2.projectmana.org/app/cache/prod/classes.php:4823
The ISP responds with:
Bad path. PHP is chrooted in /home/projectmana/.
OK. I get it that this is the problem. Web searches so far have not provided a clue as to how to proceed. (I've gained greater appreciation for Symfony wanting to avoid shared hosting.) Is there a solution that I, a relative novice and a volunteer, can implement in my code, or does the application have to find a new home?
You've got to set the doc_root variable according to your chrooted directory:
doc_root = "/home/projectmana"
cgi.fix_pathinfo = 0
You do this in the php.ini file - which seems to be not an option for you since you're on a shared server environment. When using Apache as a webserver, you can use a .htaccess file and set the proper PHP directives there via php_value.
The solution in this instance was to override the locations of the cache and logs directories according to the cookbook. This, however, by itself causes the cache:clear command to fail. The answer to that problem will have to appear in another question if I can't find it on my own.
Update
The other solution here cannot work because any php setting in .htaccess when Apache server is running FastCGI will cause a server error. Clearing the cache was never solved so the site was moved to a non-CGI host.
Related
I am running Sugarcrm CE under wamp on a windows 7 machine and I keep getting the following error. It just happens randomly and if I reload the page it seems to work. But this error is very annoying and I never used to get it under this development environment. I know if this was linux it would be a permissions issue but permissions look fine in windows to me. I have developer mode switched on and have deleted the cache folder but it still happens. Does anybody know how to prevent this?
Fatal error: sugar_file_put_contents_atomic() : fatal rename failure 'E:\wamp \www\sugargantt-project\cache\modules\Employees\tem177F.tmp' -> 'cache/modules/Employees/Employeevardefs.php' in E:\wamp\www\sugargantt-project\include\utils\sugar_file_utils.php on line 187
I had the 'cache' directory but found it was owned by 'root' so I resolved it by correcting ownership from the sugarcrm directory:
chown -R apache:apache .
Where 'apache' is your web server user.
I had this error and fixed it by editing the realpath_cache_size setting from the default of 16k to 32k in my php.ini.
realpath_cache_size = 32k
EDIT: Although, the above solution helped, this issue returned in my local development environment (I am running on Windows 7). I ended up resolving it by closing my PHP IDE, PhpED by NuSphere, and deleting the localhost debugging cookie in my browser that this IDE sets named "DBGSESSID". I re-ran my local sugarCRM instance again without PhpED and the error disappeared.
I was also facing this issue and resolved it by performing following steps
The root folder of sugar must have a folder named 'cache' in which it creates the cache files.If the folder is missing then create one.
Increase the Memory usage and script execution time in php.ini file, i had set these to Memoray: 256, Script execution time to 1000.
Visit http://localhost/?phpinfo=1 and see if WinCache or APC are enabled. They're both caching mechanisms for PHP on Windows environments, and I've had similar issues with such things in Sugar where temporary files aren't able to be deleted and rebuilt correctly.
If one or the other are enabled, you'll want to modify your active php.ini file or otherwise disable the PHP module from the WAMP menu.
Just create a cache directory in root directory of sugarcrm and check permission on it make it 777 and try hard reload it after this
I have configured Amazon EC2 Server and install PHP and MySQL. I have uploaded my website on it. it is in smarty.
Problem is when I update any .tpl file, then the server return white page as output in Firefox and Chrome return 500 Internal Server Error. I have surfed everywhere on internet but got nothing.
When I update any .php file then the code work nicely. problem is only with .tpl file.
I'm willing to bet that your templates_c directory is not writable by Apache (identified as apache or httpd, and you can check in your httpd.conf file), or it hasn't been configured correctly during Smarty initialization.
You can try temporarily setting your templates_c directory to 777 permissions to test this hypothesis.
If this ends up being the case, then you'll want to assign group ownership of templates_c to apache, and set the folder permissions to 775. (They explain this in their documentation.)
An HTTP status of 500, with no page content (Chrome is just being nice and rendering a default error message for you) means that PHP encountered a Fatal Error.
You will need to find out where PHP is configured to log to (usually a file called php_errors.log) and see what the error was.
Alternatively, you could temporarily allow PHP to output errors to screen, using the error_reporting setting.
I am trying to get my Zend application started on production environment, but i get this error:
Warning: require_once() [function.require-once]: Unable to access /var/www/web1/html/tool/lib/Zend/Loader/AutoLoader.php in /var/www/web1/html/tool/public/index.php on line 24
On development environment everything works just fine, so I figured it has to be a misconfiguration of the server.
Any ideas what could cause the problem?
I'm guessing the development system is Windows and the production environment is *nix.
The correct filename should be:
Zend/Loader/Autoloader.php
not
Zend/Loader/AutoLoader.php
Note the L vs. l. Windows filesystems are case-insensitive but your production environment is most likely case sensitve which is why it can't open that file.
If that isn't the problem, make sure the permissions on the Autoloader file and parent directories are readable by the web server.
I have a couple files that look like this:
index.php:
<?php
include('includes/header.php');
...
includes/header.php:
<?php
include('config.php');
...
The error I get is
Warning: require(config.php) [function.require]: failed to open stream: No such file or directory in [dir]/includes/header.php on line 2
Fatal error: require() [function.require]: Failed opening required 'config.php' (include_path='.:/usr/share/pear:/usr/share/php') in [dir]/includes/header.php on line 2
I did some further debugging: when I add the call
system('pwd');
to includes/header.php, it shows [dir], where it should say [dir]/includes. Adding the 'includes/' to the include path works, but isn't desirable because that would fail on the production server.
The above code works on a production server, and worked fine on my development Fedora server, until I tried to change my development environment so that the Fedora server's document root is a mounted CIFS share.
Any ideas? Thanks.
worked fine ... until I tried to change my development environment so that the Fedora server's document root is a mounted CIFS share.
Is SELinux enabled?
Check /var/log/audit/audit.log
I'm going to wager that SELinux is enabled and in enforcing mode, and is interfering.
I hate to say it, but the behavior with pwd that you're describing is 100% expected behavior (and has been since at least PHP4... probably earlier).
PHP automatically sets the current working directory (used by pwd) ONCE. PHP does not change it. Thus, . will refer to the original current working directory unless you manually change it with chdir().
There are various solutions to this problem used; most of which you can see at PHP include file strategy needed.
If it worked before, there was probably some updating of the include_path somewhere, code that changed the the working directory no longer changes it, or the php version you used that implemented this odd (but more expected) behavior no longer does so.
Anyways, I'd check the include paths: ini files, or scripts that change the include path. I'm guessing something used to update the include_path, but no longer does so.
I'm not sure about the details of how you moved it but I've encountered some annoying scripts where an .htaccess set an auto_prepend_file to a hardcoded path to a file completely outside the website structure, that set the include path (among other things) to somewhere inside the web structure.
Mounting the CIFS share with the option 'noserverino' should resolve the issue, for example:
mount -t cifs -o noserverino //host/share /mnt
Full explanation of why this works can be found here: http://www.php.net//manual/en/function.is-dir.php#98338
open function working in local server but not working on mail server
Very popular trouble:
Your local server works under Windows OS, so you can access your file without any trouble. But when you migrate from Windows to Linux, FreeBSD or other hosting you get "Access denied" error. So, you need to change access permissions to your file with FTP client or SSH.
Google for changing file permission. You will get a lot of step-by-step instructions for chmod linux command, SSH and s.o.
It will be much better, you post here some PHP output, such as warnings or errors.
Like Andrew said, it's probably a file permission problem.
If you're trying to open a remote resource (using a network protocol), you should check your phpinfo(): the configuration key allow_url_fopen must be set to on.
Could you copy/paste more details about your problem?
PHP version
complete error trace
file permissions