php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35654 Unable to open file using fopen
Submitted: 2005-12-13 08:17 UTC Modified: 2005-12-13 08:51 UTC
From: shri_sdm at yahoo dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 4.4.2RC1 OS: Linux
Private report: No CVE-ID: None
 [2005-12-13 08:17 UTC] shri_sdm at yahoo dot com
Description:
------------
Hello,

I am facing a strange problem.. i want to open a simple test.txt file using fopen in PHP. But i am unable to open file to write. I am desinging a web site using LAMP ( Linux,Apache,MySql and Php. when i execute php script in web browser fopen fails to open and echo "File Cannot be opened" in the web page. But when i execute the same script in command promt fopen successfully opens the file with some errors as followes:

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/msql.so' - /usr/lib/php4/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/imap.so' - libc-client.so.0: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/mbstring.so' - /usr/lib/php4/mbstring.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/pgsql.so' - libpq.so.3: cannot open shared object file: No such file or directory in Unknown on line 0

Please help me where i have made mistake. iam using Fedora core 3(linux),httpd-2.0.52-3(apache Server),mysql-3.23.58-16.FC3.1 and php-4.3.11-2.8. please reply as soon as possiable

Thanking You,
Shrikant Upadhya  

Reproduce code:
---------------
//fileOpening.php
<?php

	$file = fopen("/var/www/html/Sample.txt","w");
	if(!$file)
	{
		printf("File Cannot be Opened\n");
		exit(0);
	}
	printf("File Opened Successfully\n");
	fclose($file);
?>

in browser i call this file as :

http://localhost/fileOpening.php

Expected result:
----------------
"File Opened Successfully"

Actual result:
--------------
File Cannot be Opened

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-13 08:51 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This has nothing to do with fopen() and you\'re simply missing a shared library on your system which is clearly not a bug in PHP.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 20:05:44 2022 UTC