简体   繁体   English

带有 YUM 的 PHP 扩展目录

[英]PHP extensions dir with YUM

I've installed PHP on a Linux machine but can't seem to find the 'modules' directory from PHP.我已经在 Linux 机器上安装了 PHP,但似乎无法从 PHP 中找到“模块”目录。 On Mac with MAMP installed, this folder is located in ~/Applications/MAMP/bin/php/php5.3.6/ , but I can't figure out where this folder is installed on Linux, with yum .在安装了 MAMP 的 Mac 上,这个文件夹位于~/Applications/MAMP/bin/php/php5.3.6/ ,但我无法弄清楚这个文件夹在 Linux 上的安装位置, yum

Anyone who nows where yum installs these PHP-directory?现在知道 yum 在哪里安装这些 PHP 目录的人吗?


Edit: some more information about the environment编辑:有关环境的更多信息

I'm working with Amazon EC2 on an Amazon Linux AMI (ami-1624987f).我正在 Amazon Linux AMI (ami-1624987f) 上使用 Amazon EC2。 But while developing, I've used Ubuntu and installed everything (Apache, PHP, MySQL) via apt-get .但是在开发过程中,我使用了 Ubuntu 并通过apt-get安装了所有东西(Apache、PHP、MySQL)。

The installation was done by yum install php php-devel php-mysql安装是通过yum install php php-devel php-mysql

Now, when moving the application to EC2, seems like apt is not available on this AMI and I have to use yum.现在,当将应用程序移动到 EC2 时,似乎 apt 在此 AMI 上不可用,我必须使用 yum。 Seems like the yum installation is different from apt because I can't find the folder as described above.好像yum安装和apt不同,因为我找不到上面描述的文件夹。

Edit2: conclusion编辑2:结论

There were more issues so at the end I've switched from Amazon Linux to Ubuntu where I also could use apt-get.还有更多问题,所以最后我从 Amazon Linux 切换到 Ubuntu,在那里我也可以使用 apt-get。 But the answer from chanthemanless works.但是来自 chanthemanless 的答案是有效的。 Thanks everyone!感谢大家!

You can run a:您可以运行:

sudo php -i | grep extension

The output should show something like:输出应显示如下内容:

extension_dir => /blah/blah/blah extension_dir => /blah/blah/blah

Or you could run a:或者你可以运行一个:

sudo find / -name '*php*'

And look at all the places you have php files.并查看您拥有 php 文件的所有地方。

I was using PHP 7.2.24 in Amazon EC2 instance , even though extensions were installed and i was not able to locate the path.我在 Amazon EC2 实例中使用 PHP 7.2.24,即使安装了扩展并且我无法找到路径。 By doing phpinfo() I found extension_dir was set to /usr/lib64/php/modules where all directories where installed.通过执行 phpinfo() 我发现 extension_dir 被设置为 /usr/lib64/php/modules ,其中安装了所有目录。

I modified php.ini under /etc folder and still could not reflect.我修改了/etc文件夹下的php.ini还是无法反映。 But later found this very useful link Click here where i found we need to restart php-fpm after doing the modification and later restart apache.但是后来发现这个非常有用的链接点击这里我发现我们需要在修改后重新启动php-fpm,然后再重新启动apache。

sudo systemctl restart php-fpm.service须藤 systemctl 重启 php-fpm.service

I hope it helps someone.我希望它可以帮助某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM