This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

cannot create .sql file from schema.xml

Installation and environment issues, mainly on 1.x but there's some 2.x here too.

cannot create .sql file from schema.xml

by Ian » Wed Oct 26, 2005 6:07 pm

I'm trying to do the blog tutorial, and have created schema.xml with the data from the tutoral.

When I do symfony build-model and symfony build-sql it does not create the .sql file. I have checked in the /data/sql directory and it's empty. I don't get any error messages from the symfony command.

Running Symfony 0.4.1 on Windows XP, Apache 2, PHP 5.0.4, MySQL 4.1

Thanks.
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by fabien » Wed Oct 26, 2005 8:31 pm

Can you post the result of the
Code: Select all
symfony build-sql
command?
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by Ian » Thu Oct 27, 2005 12:50 am

It does not give me a message at all. When I run the command, it just goes back to the command prompt with no message. Same with the build-model command.
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by xiblack » Thu Oct 27, 2005 3:31 am

Just a guess: it can be the zend.ze1_compatibility_mode problem.
You can check it here: http://www.symfony-project.com/forum/index.php/t/10/

I tried 'symfony build-model' and 'symfony build-sql' in 'zend.ze1_compatibility_mode=on' and both did not work.
xiblack
Member
 
Posts: 34
Joined: Tue Oct 25, 2005 4:59 am

Re: cannot create .sql file from schema.xml

by Ian » Thu Oct 27, 2005 5:32 am

I double checked my php.ini and it's already set to "Off". Thanks anyway.

Out of curiosity, what is it supposed to output when the command is run successfully?
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by xiblack » Thu Oct 27, 2005 11:42 am


Out of curiosity, what is it supposed to output when the command is run successfully?


FYI, here are the outputs on my computer:

For command 'symfony build-model':
Code: Select all
Buildfile: ~myfolder/lib/symfony-trunk/data/symfony/bin/build.xml

sf > build-om:
    [phing] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build.xml' with target 'om'

propel-project-builder > projectcheck:

propel-project-builder > configure:
     [echo] Loading project-specific props from ~myfolder/www/sfTe
st/config/build.properties

propel-project-builder > om:
    [phing] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build-propel.xml' with target 'om'

propel > check-run-only-on-schema-change:

propel > om-check:

propel > om:
     [echo] +------------------------------------------+
     [echo] |                                          |
     [echo] | Generating Peer-based Object Model for   |
     [echo] | YOUR Propel project! (NEW OM BUILDERS)!  |
     [echo] |                                          |
     [echo] +------------------------------------------+
[phingcall] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build-propel.xml' with target 'om-template'

propel > om-template:
[propel-om] Target database type: mysql
[propel-om] Target package: model
[propel-om] Using template path: ~myfolder/lib/symfony-trunk/lib/p
ropel-generator/templates
[propel-om] Output directory: ~myfolder/www/sfTest/lib
[propel-om] Processing: schema.xml
[propel-om] Processing Datamodel : schema.xml
[propel-om]   - processing database : symfony
[propel-om]     + weblog_post
[propel-om]             -> BasePostPeer [builder: sfPeerBuilder]
[propel-om]             -> BasePost [builder: sfObjectBuilder]
[propel-om]             -> PostMapBuilder [builder: PHP5MapBuilderBuilder]
[propel-om]             -> PostPeer [builder: PHP5ExtensionPeerBuilder]
[propel-om]             -> Post [builder: PHP5ExtensionObjectBuilder]
[propel-om]     + weblog_comment
[propel-om]             -> BaseCommentPeer [builder: sfPeerBuilder]
[propel-om]             -> BaseComment [builder: sfObjectBuilder]
[propel-om]             -> CommentMapBuilder [builder: PHP5MapBuilderBuilder]
[propel-om]             -> CommentPeer [builder: PHP5ExtensionPeerBuilder]
[propel-om]             -> Comment [builder: PHP5ExtensionObjectBuilder]

BUILD FINISHED

Total time: 1 minutes  21.36 seconds



For command 'symfony build-sql':
Code: Select all
Buildfile: ~myfolder/lib/symfony-trunk/data/symfony/bin/build.xml

sf > build-sql:
    [phing] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build.xml' with target 'sql'

propel-project-builder > projectcheck:

propel-project-builder > configure:
     [echo] Loading project-specific props from ~myfolder/www/sfTe
st/config/build.properties

propel-project-builder > sql:
    [phing] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build-propel.xml' with target 'sql'

propel > check-run-only-on-schema-change:

propel > sql-check:

propel > sql:
     [echo] +------------------------------------------+
     [echo] |                                          |
     [echo] | Generating SQL for YOUR Propel project!  |
     [echo] |                                          |
     [echo] +------------------------------------------+
[phingcall] Calling Buildfile '~myfolder/lib/symfony-trunk/lib/pro
pel-generator/build-propel.xml' with target 'sql-template'

propel > sql-template:
[propel-sql] Processing: schema.xml
[propel-sql] Target database type: mysql
[propel-sql] Target package:
[propel-sql] Using template path: ~myfolder/lib/symfony-trunk/lib/
propel-generator/templates
[propel-sql] Output directory: ~myfolder/www/sfTest/data/sql
[propel-sql] Generating SQL tables for database: symfony
[propel-sql] Writing to SQL file: ~myfolder/www/sfTest/data/sql/sc
hema.sql
[propel-sql]     + weblog_post
[propel-sql]     + weblog_comment

BUILD FINISHED

Total time: 1 minutes  1.62 second


My computer is an old one and quite slow (PIII 700MHz 256MB RAM) so the time to generate model and sql are quite long.

xiblack
xiblack
Member
 
Posts: 34
Joined: Tue Oct 25, 2005 4:59 am

Re: cannot create .sql file from schema.xml

by Ian » Thu Oct 27, 2005 6:15 pm

Ok, well mine is DEFINITELY not working then lol. It probably has something to do with windows. Ive got apache2triad (apache2triad.net) installed so you never know what they hacked out of the regular apache/php config.

Any ideas?
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by fabien » Fri Oct 28, 2005 7:41 am

Could you check there is no white space in your project path? I know some people have problem with white space in their path.
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by cerad » Fri Oct 28, 2005 3:36 pm

Did you install Phing? It's possible that your php.ini file is suppressing error messages and thus you are not seeing the "unable to find Phing.php" stuff.
cerad
Junior Member
 
Posts: 11
Joined: Sun Oct 23, 2005 7:02 pm

Re: cannot create .sql file from schema.xml

by Ian » Fri Oct 28, 2005 5:26 pm

I deleted the entire project and started over from scratch, using the exact syntax from the tutorial (myproject/myapp).

I verified that Phing IS installed, and i've done everything from the tutorial. Still, I have no message whatsoever from running the build-model and build-sql commands. Strange. Is there no log file that the app generates? That would be handy.

I'm going to install this on my linux box later because this is ridiculous.
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by Venatyr » Fri Oct 28, 2005 9:41 pm

I am having the exact same problem on Linux.

Code: Select all
# symfony -t build-model
>> invoke build-model (first_time)
>> invoke project_exists (first_time)
>> execute project_exists
>> execute build-model


And that's it. I have no idea what's wrong.
Venatyr
Junior Member
 
Posts: 3
Joined: Fri Oct 28, 2005 8:53 pm

Re: cannot create .sql file from schema.xml

by Ian » Fri Oct 28, 2005 9:49 pm

I just installed symfony on fedora core 4 and now it's working fine.

symfony build-model and build-sql work like they should.

Maybe this is a bug for windows?
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by Ian » Fri Oct 28, 2005 9:51 pm

Venatyr wrote: I am having the exact same problem on Linux.

Code: Select all
# symfony -t build-model
>> invoke build-model (first_time)
>> invoke project_exists (first_time)
>> execute project_exists
>> execute build-model


And that's it. I have no idea what's wrong.



You don't need to use -t when running build-model or build-sql
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by Venatyr » Fri Oct 28, 2005 10:05 pm

acidbox wrote:
You don't need to use -t when running build-model or build-sql


I know, I thought a trace would provide some more info.
Venatyr
Junior Member
 
Posts: 3
Joined: Fri Oct 28, 2005 8:53 pm

Re: cannot create .sql file from schema.xml

by forkmantis » Mon Nov 07, 2005 7:26 pm

I am also unable to build the model or sql for the blog tutoral. However, I'm actually getting an error message, as follows:

Code: Select all
-sh-3.00$ symfony build-model
ERROR: pake - property "symfony/name" does not exist

-sh-3.00$ symfony build-sql
ERROR: pake - property "symfony/name" does not exist


I searched these message boards and google for the error message to no avail. This is my first experience w/ Pake, Phing, etc. Any help or ideas would be greatly appreciated.
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Mon Nov 07, 2005 7:51 pm

Strange, it seems you don't have some configuration entries in the config/properties.ini global configuration file.

It must at least contain:

Code: Select all
[symfony]
  name=YOUR_PROJECT_NAME


Could you check and tell me if this file is correct?
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Mon Nov 07, 2005 7:56 pm

That part seems to be in order:

Code: Select all
-sh-3.00$ cat properties.ini
[symfony]
  name=myproject
-sh-3.00$
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by Ian » Mon Nov 07, 2005 10:59 pm

try doing an svn checkout on the latest version and starting from scratch.

Just a note, i never got symfony to work correctly on PC. I had to do all my symfony commands on my fedora box to get it working, so if you have access to a linux machine, try that instead.
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by forkmantis » Tue Nov 08, 2005 12:33 am

I got the latest version of symfony from svn, but the problem persists.

In running through the process again, I noticed something that makes me wonder if the problem is occurring in earlier steps of the tutorial. when I type:

Code: Select all
mkdir myproject
cd myproject
symfony init-project myproject
symfony init-app myapp


and then view my page, I get

Code: Select all
<html><body></body></html>


rather than the "congratulations" page I saw in the AJAX screencast. Do you think the problem may be occurring there? It does create files in the myproject directory, and none of the output of the init-project and init-app commands seem to imply any errors. Should I be seeing the "Congratulations" screen?

BTW, I'm using Mac OS X 10.3, which should be *nix-y enough to handle the command line portions of the tutorial.
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by Ian » Tue Nov 08, 2005 12:54 am

Are you using Apache?

If so, make sure the address you're visiting has the appropriate vhost information in the httpd.conf.

I added this to the bottom of my /etc/httpd/conf/httpd.conf file.

Code: Select all
<VirtualHost *:80>
        DocumentRoot /var/www/html/myproject/web
        ServerAdmin root@localhost
        ServerName testapp.com
        ServerAlias www.testapp.com
        DirectoryIndex index.php index.html
        <Directory "/var/www/html/test/web">
                AllowOverride All
        </Directory>
</VirtualHost>


Then, I edited /etc/hosts (c:\windows\system32\drivers\etc\hosts for windows) and added:

Code: Select all
192.168.0.103   testapp.com
192.168.0.103   www.testapp.com


Make sure you change the IP above to the IP of your local web server. If it is on your computer, the IP will be 127.0.0.1.

Then restart apache and do a symfony cc to clear the cache.

This should get it setup correctly and pointing to the right place.
Ian

Join us on IRC for LIVE support!
Report bugs here.
Ian
Faithful Member
 
Posts: 386
Joined: Tue Oct 25, 2005 6:53 pm
Location: Boulder, CO (USA)

Re: cannot create .sql file from schema.xml

by forkmantis » Tue Nov 08, 2005 1:12 am

Thanks for the help, acidbox.

However, I have already configured Apache as you have described. To verify that it's working, I created a helloworld.php file, and was able to access it from the server.

Any other thoughts?
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by forkmantis » Tue Nov 08, 2005 11:02 pm

I've been fiddling with this more today.

On my server at work, we're running Fedora Core 4, and I keep getting hung up at the same point, when I try to run:

Code: Select all
symfony build-model


I get the following:

Code: Select all
ERROR: pake - property "symfony/name" does not exist


I did a quick test on my home machine, running Ubuntu, and was able to run the build-model and build-sql commands successfully.

I searched through the pake code and found the line where it's declaring the above error message. I put a print_r($properties) just above, and the array of properties was empty.

Is there an easy way for me to test if the properites file is accessible to the pake script? Could permissions possibly be an issue? Are there other things I could be checking?
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Tue Nov 08, 2005 11:16 pm

The properties.ini file is loaded by the pake_properties function which is in the pake.php php file.

Here is the function:

Code: Select all
function pake_properties($property_file)
{
  $file = $property_file;
  if (!file_exists($file) && file_exists(getcwd().DIRECTORY_SEPARATOR.$property_file))
  {
    $file = getcwd().DIRECTORY_SEPARATOR($property_file);
  }

  if (file_exists($file))
  {
    pakeApp::get_instance()->set_properties(parse_ini_file($file, true));
  }
  else
  {
    throw new Exception('properties file does not exist');
  }
}


You can print_r the results of parse_ini_file($file, true) to see if the parsing is OK.

PS : I just noticed there is a wrong construction in the if, perhaps it is related to your problem. You can change:

Code: Select all
    $file = getcwd().DIRECTORY_SEPARATOR($property_file);


to

Code: Select all
    $file = getcwd().DIRECTORY_SEPARATOR.$property_file;

and see if it corrects your problem.
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Tue Nov 08, 2005 11:51 pm

Fabien,

Thanks for your quick response.

I made the change you recommended, and tried to echo out some debugging information, by modifying the function as follows:

Code: Select all
function pake_properties($property_file)
{
  $file = $property_file;
  if (!file_exists($file) && file_exists(getcwd().DIRECTORY_SEPARATOR.$property_file))
  {
    $file = getcwd().DIRECTORY_SEPARATOR.$property_file;
  }

echo '<!--'." ";
echo '$file = '.$file." ";
print_r(parse_ini_file($file, true));
echo '-->'." ";
  if (file_exists($file))
  {
    pakeApp::get_instance()->set_properties(parse_ini_file($file, true));
  }
  else
  {
    throw new Exception('properties file does not exist');
  }
}


However, the error must be happening before this function gets called. When I run the code, I get the same error, but never see any of the debug info:

Code: Select all
-sh-3.00$ symfony build-model
ERROR: pake - property "symfony/name" does not exist
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Tue Nov 08, 2005 11:58 pm

Strange,

When you launch symfony build-model, here are the steps:

1 - call the run_project_exists function defined in pakefile.php and load properties.ini
2 - launch the run_build_model

It seems that the run_project_exists function is not called. Could you check that?
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Wed Nov 09, 2005 12:11 am

You are correct. The run_project_exists function was never called. I modified the function as follows:

Code: Select all
function run_project_exists($task, $args)
{
echo '<!-- function run_project_exists has been run!!! -->'."\m";
  if (!file_exists('SYMFONY'))
  {
    throw new Exception('you must be in a symfony project directory');
  }

  pake_properties('config/properties.ini');
}


then ran this code and got this result:

Code: Select all
-sh-3.00$ symfony build-model
ERROR: pake - property "symfony/name" does not exist
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Wed Nov 09, 2005 12:16 am

OK, so before that, the build_model task is defined in the define_task method in the pakeTask.class.php file.

It registers task dependencies, here project_exists task, via the $task->enhance($deps) line. You can print the $deps to see if project_exists is there. If yes, you can trace what happens in the enhance method.
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Wed Nov 09, 2005 12:52 am

the build_model task does have a single dependency:

Code: Select all
Array
(
    [0] => project_exists
)


At the conclusion of the pakeTask->enhance method, a print_r of the task's prerequisites returns an identical array.

I would assume that this is what was expected. So I guess the question that remains is why is the run_project_exists function not running?
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Wed Nov 09, 2005 4:21 pm

I just released a new pake and symfony and I think (hope) your problems will be fixed.
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Wed Nov 09, 2005 5:48 pm

Do I have the correct versions of pake and symfony? Should I be getting them manually rather than from pear? Unless I did not get the version that you updated, then the problem is still present:

Code: Select all
-sh-3.00$ pear list-all --channel=symfony
Retrieving data...0%.All packages:
=============
Package         Latest Local
symfony/pake    1.0.74 1.0.74 pake
symfony/symfony 0.5.89 0.5.89 symfony framework


-sh-3.00$ symfony build-model
ERROR: pake - property "symfony/name" does not exist
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Wed Nov 09, 2005 6:01 pm

You have the latest releases... we have to investigate more...
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by forkmantis » Wed Nov 09, 2005 6:06 pm

I have one or two tasks to perform today, but should be able to set aside some time to work with symfony. If there is anything specific that I can do to help out, please let me know.
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by forkmantis » Thu Nov 10, 2005 11:15 pm

I had a chance to look through the code some more today. It looks like somehow the prerequisite is getting dropped before the invoke method is called. I added this code inside the pakeTask::invoke method. I included a little bit of the surrounding code so you could see what I'm talking about:

Code: Select all
    // return if already invoked
    if ($this->already_invoked) return;
     $this->already_invoked = true;
 
     // run prerequisites
     $tasks = self::get_tasks();
 echo 'taskName = '.$this->name." ";
 echo '$this->prerequisites = '." ";
 print_r($this->prerequisites);
     foreach ($this->prerequisites as $prerequisite)
     {
       ...


and when I run it, you can see that the project_exists dependency is not present:

Code: Select all
-sh-3.00$ symfony build-model
taskName = build-model
$this->prerequisites =
Array
(
)
ERROR: pake - property "symfony/name" does not exist


I can see that there are a lot of static calls being made to the pakeTask object. I don't have a lot of personal experience with static variables/objects/methods yet, so I am not sure how they should be behaving, but it appears that perhaps the pakeTask object is getting reset?

I just wonder why it would work on one machine and not another? I did get the symfony build-model command to work on my machine at home, running ubuntu linux and PHP 5.0.4. The machine that I need it to run on is at work, and runs Fedora Core 4, and also runs PHP 5.0.4.

Any thoughts on how that prerequisite could be disappearing?
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by forkmantis » Fri Nov 11, 2005 12:10 am

:oops:

I should have paid more attention to the information that was available to me here.

The server I was trying to install symfony on here at work had zend compatability set.

I apologize for taking up your time on this.

http://www.symfony-project.com/forum/index.php/t/10/
will killian
forkmantis
Member
 
Posts: 37
Joined: Mon Nov 07, 2005 7:23 pm
Location: Texas

Re: cannot create .sql file from schema.xml

by fabien » Fri Nov 11, 2005 10:24 am

I added a check for zend.ze1_compatibility_mode in php.yml and will add one to symfony.php to prevent further problems.
fabien
Faithful Member
 
Posts: 487
Joined: Sat Oct 22, 2005 9:01 am

Re: cannot create .sql file from schema.xml

by Arsenio » Sat Nov 12, 2005 4:29 pm

I also cannot create an sql file from schema.xml, but symfony gets a little further in my case:

(..)
[propel-om] Processing: schema.xml
Execution of target "om-template" failed for the following reason: C:\prj\config
\schema.xml:1:1: Empty document
[phingcall] C:\prj\config\schema.xml:1:1: Empty document

The file DOES exist.
I've tried both, dos and unix newlines.
I've copied and pasted the schema.xml from http://www.symfony-project.com/tutorial/my_first_project.htm l
I've tried it on xp only.
Arsenio
Junior Member
 
Posts: 1
Joined: Sat Nov 12, 2005 4:21 pm