Re: [PHP] reading/editing php file with php script



On Sat, 2007-01-06 at 15:12 -0800, jekillen wrote:
Hello;
I have been writing a php script which is supposed to open and edit a
php file on the same server,
in the same directory. But I have not been able to get regex as in
function ereg() to work to match
a line of code to alter. I also have not been able to get strpos() to
work in this code. I am not
complaining, i am just curious if this is a security feature of php,
that it can't be used to open
and edit existing script files on a web server. Or am I doing something
wrong? I have successfully
used php to write a php script file from scratch and then include it.
It works good for keeping track
of things on the server.

PHP can open and write to any file for which it has permissions. Have
you checked your error log? Have you checked the return value of
fopen()? Have you checked that the file permissions allow the webserver
read/write access to the target file? Can you read the file but not
write? Does file_exists() return true or false for the file?

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
.



Relevant Pages

  • Re: Session variables are lost, disappear from page to page
    ... MS Windows Server 2003 ... says 'edit records' and 'delete records'. ... the data in the session array is gone. ... I think it's a PHP bug, but PHP support won't acknowledge it as a bug, ...
    (comp.lang.php)
  • Re: [PHP] Out source files
    ... Is it considered as secure? ... Assuming you control the other server, you can make it as secure as ... Or you could use PHP ftp functions to shuffle them around. ... securing or the PHP script is so badly-written that jumping through ...
    (php.general)
  • Re: Session variables are lost, disappear from page to page
    ... MS Windows Server 2003 ... says 'edit records' and 'delete records'. ... the data in the session array is gone. ... I think it's a PHP bug, but PHP support won't acknowledge it as a bug, ...
    (comp.lang.php)
  • Re: PHP Instalation problems. Browser doesnt know what to do
    ... This is loaded and run as a local server (for class ... PHP 5.2.0 from php-5.2.0-win32-installer.msi ... # configuration directives that give the server its instructions. ...
    (comp.lang.php)
  • Re: PHP Instalation problems. Browser doesnt know what to do
    ... This is loaded and run as a local server (for class ... PHP 5.2.0 from php-5.2.0-win32-installer.msi ... # configuration directives that give the server its instructions. ...
    (comp.lang.php)