0

I am developing a small software project management tool. One thing this tool is supposed to do is generating setup scripts for deployment of projects on clients' hosts. For this, I need to save CREATE, ALTER, and DROP queries that PHPMyAdmin generates when creating/updating the DB schema for projects.

To do that, I have written a script that I require from within tbl_create.php with

require_once('/var/www/projects/lucy/services/db_change_logger.php');

The require fails with the following error message. What is wrong?

Fatal error: require_once() [function.require.html]: Failed opening required '/var/www/projects/lucy/services/db_change_logger.php' (include_path='.') in /usr/share/phpmyadmin/tbl_create.php on line 225

Update Here is result of proposed probing by @mschuett:

majid@majid-1015PX:~$ cd /var/www/projects/lucy/services/
majid@majid-1015PX:/var/www/projects/lucy/services$ pwd
/var/www/projects/lucy/services
majid@majid-1015PX:/var/www/projects/lucy/services$ ls -la
total 20
drwxrwxrwx 2 majid majid 4096 2014-09-17 00:01 .
drwxrwxrwx 8 majid majid 4096 2014-09-16 11:02 ..
-rwxrwxrwx 1 majid majid  669 2014-09-17 00:01 db_change_logger.php
-rw-rw-rw- 1 majid majid  531 2014-09-16 12:54 list_projects.php
-rw-rw-rw- 1 majid majid    0 2014-09-16 00:57 project_def.php
-rw-rw-rw- 1 majid majid 1265 2014-09-16 18:28 watchdog.php
Majid Fouladpour
  • 29,356
  • 21
  • 76
  • 127
  • This is by no means a solution but does running chmod 777 on that file and then running it again cause it to run without the fatal error? This can help determine the cause of the issue. – michael.schuett Sep 16 '14 at 20:44
  • it looks like the user phpmyadmin is running under doesn't have permission to access that script – cmorrissey Sep 16 '14 at 20:44
  • @mschuett I have `chmod`ed the directory, but the error occurs still. – Majid Fouladpour Sep 16 '14 at 20:46
  • I am a bit stumped on this one. Can you navigate to the /var/www/projects/lucy/services/ folder and run pwd and also a ls -la and add the output above? – michael.schuett Sep 16 '14 at 20:57
  • @cmorrissey shouldn't `chmod 777 /var/www/projects/lucy/services/db_change_logger.php` fix permission? – Majid Fouladpour Sep 16 '14 at 20:59
  • @MajidFouladpour yes if this was just a permission issue anyone should be able to include that file from any user on your system now. – michael.schuett Sep 16 '14 at 21:01
  • @mschuett just added the log. – Majid Fouladpour Sep 16 '14 at 21:05
  • @MajidFouladpour what os is your server running this on? I am going to spin one up and try to include a file from phpmyadmin. – michael.schuett Sep 16 '14 at 21:25
  • It's possible your `include_path` is weird... try `$path = str_replace("/", DIRECTORY_SEPARATOR, "/var/www/projects/lucy/services/"); set_include_path($path . PATH_SEPARATOR . get_include_path() ); require_once("db_change_logger.php");` – dave Sep 16 '14 at 21:26
  • @mschuett this is happening on Ubuntu 11.10 – Majid Fouladpour Sep 16 '14 at 21:29
  • @dave no, even with the path added it still fails. The error message has changed now to `Fatal error: require_once() [function.require.html]: Failed opening required 'db_change_logger.php' (include_path='/var/www/projects/lucy/services/:.') in /usr/share/phpmyadmin/tbl_create.php on line 228` – Majid Fouladpour Sep 16 '14 at 21:36
  • @mschuett there is [this comment](http://stackoverflow.com/questions/4917811/file-put-contents-permission-denied#comment27129251_4917999) on a similar question which might be the root cause here too. I tried several variants with `+x` added in various places but couldn't get the syntax right. Could you say what the correct syntax is? Thanks. – Majid Fouladpour Sep 16 '14 at 21:55
  • @MajidFouladpour you should just be able to run chmod +x filename.php and it will be good. Let me know if that works! – michael.schuett Sep 18 '14 at 00:38
  • @mschuett no it didn't and then I changed my approach and used curl to send the query to db_change_logger.php. Still wondering why file accsess fails though. – Majid Fouladpour Sep 20 '14 at 05:11

0 Answers0