Drupal Internal Error - php

I have a problem, i moved my drupal site, and i can see all my sites working. But sometimes when i editing them it comes "Internal Server Error". I think there is something wrong with my htaccess or my webconfig. As someone told me IIS doesn't use htaccess, but than it uses web.config. The problem is it sometimes shows Error, sometimes not. So i think it has something to do with timeouts or something like that? Could that be?
I find out, what to do that the browser shows me the exact error:
It's this: "PHP Warning: session_start(): Trying to destroy uninitialized session in D:\Parallels\Plesk Panel\Vhosts\example.de\httpdocs\Intranet\includes\bootstrap.inc on line 1165
PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in D:\Parallels\Plesk Panel\Vhosts\example.de\httpdocs\Intranet\includes\bootstrap.inc on line 1165"
Can you see something, where there is something wrong?

IIS doesn't use .htaccess files. It is a different beast altogether. It is unusual to run Drupal on Windows much less IIS, so you may not find much information. Luckily, Microsoft has their own Drupal distro that you can find at http://www.microsoft.com/web/drupal. You can use their distro as-is or as a template for configuring your own installation.

Related

Http request failed after site migration - server issue

So I have a website built in php and it was working perfectly on one server, I then moved the website to a server I have on Digital Ocean and am running into several errors, they seem to be based around http request failures while using the imagick library...
I was hoping to not to have to start debugging this from a code point of view as it was already working perfectly and would prefer to change server settings.
Fatal error: Uncaught exception 'ImagickException' with message 'Imagick::__construct(): HTTP request failed! HTTP/1.1 404 Not Found .
I cannot figure out what differences there, on both server allow_url_fopen is set to on.
The php version is different, 5.520 on the original server, 5.5.9 on the new server.
The versions of imagick are the same. I am also getting some other errors using the mpdf library but I will try deal with these later (Im hoping if I can resolved the first ones these ones will also get resolved).
My question is , is there possibly any other setting on the server I should be looking out for that may be causing these php errors?
EDIT:
Just to add more information, i can get rid of some of the errors by changing the file path https://www.example.com/myimage.jpg to /var/www/example/myimage.jpg . This solves some of the errors but I would rather get the root of the issue thats causing it not to work in the first place, because I feel that its the same problem thats causing other errors.
The error code says it: 404, file not found. You are probably using the wrong URL.
Are you able to fetch https://www.example.com/myimage.jpg using a webbrowser?
On several popular linux distros, /var/www/example/myimage.jpg would be served at https://www.example.com/example/myimage.jpg instead of https://www.example.com/myimage.jpg with the default configuration.
[edit]
It just came to my attention that the URL is HTTPS, there is a possibility that the script is rejecting the server certificate. Try with regular HTTP - no point in using SSL if the file is on the same machine.

Drupal Error: Undefined Offset: 0 error & Fastcgi

Thanks for reading this. I apologize if there is a simple solution to this but I have been through the forums/Google to find a fix and no luck as yet.
I am getting a Notice: Undefined offset: 0 error. The landing page renders but but all links shoot straight to a "Not Found" error page.
Are these two issues related? I read somewhere, that the Notice: Undefined offset: 0 error is from not having fastcgi as the php rendering engine. Is this correct? and will this solve that issue?
The server is Windows based with Plesk.
You can view the issue here
http://southbaypontoons.com.au/
Thanks in advance for the help!
The first issue, where you are getting 404 files errors for all of your links looks like it might be a rewrite issue.
I am not sure what webserver you are using with Plesk for Windows, but most likely it is IIS - the webserver that comes with Windows.
See this page for the rewriterules: http://drupal.org/node/3854
This will work if you have the IIS rewrite plugin for IIS (http://www.iis.net/downloads/microsoft/url-rewrite) If it is not your own server, you may need to ask your webhost to enable it.
As for the missing images - they are there. Look for example at http://southbaypontoons.com.au/sites/default/files/banner/slider-img1.jpg ... this is the image that is on the top of the home page.
It seems like you need to go through all of your drupal content and remove the /drupal/ at the front of all the images.

WP E Commerce Safe Mode restriction error

I have my online shop, created with WP Ecommerce getting broken after I moved it to another server. I could be sure that the problem comes from WP Ecommerce because when I disable that plugin. Everything run as expected. This is the exact error message
Warning: session_start() [function.session-start]: SAFE MODE Restriction in effect. The script whose uid is 515 is not allowed to access /tmp owned by uid 0 in /home/mikalu/public_html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 17
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: files (path: ) in /home/mikalu/public_html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 17
I've tried to turn off safe mode on my php configuration. nothing happens. the error's still there.
I thought it was some kind of permission issue, so I tried to change /tmp permission to 777. Nothing happens. I googled it some more and suspect it might have something to do with fastCGI configuration and stuff. Which I totally don't understand.
My googling result mostly suggest me to consult the web hosting provider or even to move to another host. But in this case, I am the owner of the server (VPS with cPanel/WHM). And I don't have any idea how to solve this kind of problem
Any help would be very much appreciated :)
edit: I'm not so sure of this is really a server issue. Because if it really server configuration issue on session save path. Then the whole wordpress shouldn't be working coz it obviously use some session too. The session problem only come from that particular wp-ecommerce script. That's why I post it here on stackoverflow too.
After your edit, it's more clear why you ask that question. Wordpress itself does not uses PHP session, so it's not causing the issue but those component you're using is using PHP sessions.
The PHP manual normally is a good start to understand safemode and how to disable it: http://php.net/manual/features.safe-mode.php
Additionally you should review your server configuration that it is safe instead. Safe-mode is unsafe. Hopefully your server ain't.

Deploying a Symfony2 project

We were working on a Symfony2 project. Now, it's done and ready to be deployed. We uploaded the whole project files to the server (via ftp of course) and the database as well. Now when we open any page of it we got just a blank page (empty source code). Cache is clean, logs do not show anything new. We googled the steps of deploying a Symfony2 project to a hosting but we did not find a good explanation (even these ones were about Symfony not-version-2).
We believe it maybe a configuration issue, but no idea so far.
Any help will be greatly appreciated.
Thanks in advance.
Edit: the blank page is in Firefox. Google Chrome is saying something:
Server error The website encountered an error while retrieving
http://*.com/mammoky/web/app_dev.php/main. It may be down for
maintenance or configured incorrectly. Here are some suggestions:
Reload this webpage later. HTTP Error 500 (Internal Server Error): An
unexpected condition was encountered while the server was attempting
to fulfill the request.
error_log is showing:
[24-Mar-2012 23:29:24] PHP Parse error: syntax error, unexpected
T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in
/home/leadow33/public_html/mammoky/web/app.php on line 7
It's: use Symfony\Component\HttpFoundation\Request;
And
[24-Mar-2012 23:15:08] PHP Warning: Unexpected character in input:
'\' (ASCII=92) state=1 in
/home/leadow33/public_html/mammoky/web/config.php on line 84
It's: $reflector = new \ReflectionExtension('intl');
EDIT: I've posted my solution, check it out down here.
Answer:
I got it to work, this is my experience:
Upload the whole project folder to the server.
Enter www.your-website.com/project-name/web/config.php.
It should say: "This script is only accessible from localhost".
Open this web site: http://www.whatismyip.com, it should show you your public IP address, copy it.
Open the config.php from the admin panel (like cPanel) and edit that config.php:
if (!in_array(#$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', /*your IP here*/))) {
header('HTTP/1.0 403 Forbidden');
die('This script is only accessible from localhost.');
}
Refresh your config.php file, the page will tell you if your system is missing some required conditions like: PHP version, APC extension, giving /cache and /log folders permissions to write on, etc.
After you provide the required conditions you'll see a form of configuring you project to connect to a database if you have one, this step is pretty simple.
Open the link www.your-website.com/project-name/web/app_dev.php, it'll help you get started with Symfony2 project.
In case you got in app_dev.php this message: You are not allowed to access this file... just do the same thing to app_dev.php as you did in steps 4 and 5 (add your public IP address to the array).
Note of Hakan Deryal (comment): If you don't have a fix IP address, you need to do this last step each time you get a new IP adrdress from the DHCP. So to solve that, open the app_dev.php and comment out the line die('You are not allowed to.., however this is not a recommended way because you're disabling the built-in security of the file.
One thing stopped me and may stop you too, the server I deployed the project on, was case-sensitive (unlike the localhost on my computer), so it kept telling me that the template (Index.html.php for example) does not exist, however it does exist, but I did return $this->render('...:index.html.php') with small i in DefaultController.php. So render the exact template (file) name with the same letters cases.
Now everything is going well, I hope that helps you.
In my case it was the php version* and I catched the error by running config.php with removed lines for checking ip address. On my hosting I just changed the default version of PHP for my scripts.
*Since namespaces are only from 5.3.
production isnt app_dev but app.. The page might be the same did you do a view source? Did you try to run the config.php that comes with the framework zip ?
If your installation runs on a shared webserver, try setting the following line into the app.php:
date_default_timezone_set('America/Los_Angeles');
This solves the problem in my case.

imagecreatefromjpeg() error - Why is my image manipulation script failing?

I am currently using an image manipulation script to do some work on uploaded images and I'm running into a problem in my dev environment. This same code works on my production server.
The error is:
PHP Warning: imagecreatefromjpeg(): php_network_getaddresses:
getaddrinfo failed: Name or service not known in /path/to/script.php
on line 75
The line of code on 75 is:
$this->img = imagecreatefromjpeg(PHPTHUMB."?src=/".$this->image_path);
which creates an image that is loaded from another made by phpThumb, which is used for further manipulation.
Any ideas on how to solve this? Can anyone shed some light on what the error means?
Thank you,
Edit:
Just as a further bit of insight, if i visit PHPTHUMB . "?src=/" . $this->image_path in my browser, the image loads fine
User agent in php.ini did not solve the problem as indicated here
EDIT (SOLUTION): I had to add the INTERNAL 192.168.204.XXX IP into the hosts file, so that http://dev.mysite.com resolved correctly. Trying both 127.0.0.1 and the external IP yielded no result, but the internal works perfectly. Thanks for everyone's efforts,
I'm totally not sure about the cause of that error, but this is my best guess.
There is a particular PHP Setting which enables you to treat URLs as files. Normally imagecreatefromjpeg accepts a filename, I think. Since you are passing a URL, you need to make sure the particular setting is enabled. I believe you can find more info about it here: http://us2.php.net/file
filename
Path to the file.
Tip
A URL can be used as a filename with this function if the fopen
wrappers have been enabled. See
fopen() for more details on how to
specify the filename and List of
Supported Protocols/Wrappers for a
list of supported URL protocols.
Fopen wrappers: http://us2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
Your dev environment may not be setup with this, but your production environment could be.
Edit
This page lists your error:
http://bugs.php.net/bug.php?id=11058
and mentions that a possible fix is by modifying your hosts file to explicitly include the ip/dns of the server you're accessing.
i tryed to reconfigure my named
configuration, without any result, to
fix this. the problem was solved by
adding the following line to my
/etc/hosts:
194.97.55.147 mx.freenet.de
Maybe you can try this?
did you also check that allow_url_fopen is set to On in php.ini?
I saw that they did mention that in the article you referred to in your post.
EDIT: Also, what OS and what PHP version are you running?
Just read this on php.net: "On Windows versions prior to PHP 4.3.0, the following functions do not support remote file accessing: include(), include_once(), require(), require_once() and the imagecreatefromXXX functions in the GD Functions extension."
EDIT2:
I just read what was written in the comments, your allow_url_fopen is set to On, sorry about that.
But OS, PHP version and phpinfo() would help in finding the problem.
The error message suggests something is wrong at a networking level. Thus, if possible, bypass that. Try using the path to the thumbnail generator, instead of a network address.
If that's not an option, try something that will give you more granular error messages. I suggest CURL. At the very least, it should yield a more informative error message.
The simple fact that this is failing is because on your webserver, your DNS resolution is broken.
If you have SSH access to your server, try the following command
dig hostname
where hostname is the host name from PHPTHUMB
This will probably fail.
Assuming that you're using Linux, my suggestion would be to edit your /etc/resolv.conf (as root)
and add the following line before any other lines beginning with "nameserver"
nameserver 4.2.2.2
This should hopefully fix things, though you may have to restart apache (or whatever webserver you're using)!
The issue here is that php fails to resolve the url that you provide as PHPTHUMB as stated in this bug report on php.net. This possibly means that it's the fault of the operating system/web server, in which case you can enter the ip address of the server you are connecting to into your hosts file manually.

Categories