PHP启动:无法加载动态库`curl.so` Ubuntu

时间:2016-11-01 08:40:56

标签: php apache curl ubuntu-14.04 php-extension

  

PHP警告:PHP启动:无法加载动态库   ' /usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so:   未定义的符号:第0行的未知中的zend_unset_property

我正在使用Ubuntu 14.04 LTS和PHP v5.6

同一台计算机php5php7中还有其他版本,但php5.6已启用。我试图通过

安装cURL
sudo apt-get install php5.6-curl

现在我要

  

无法加载动态库curl.so

运行php -i | grep ini后,我得到以下内容

root@ubuntu:/etc/php/5.6/apache2# php -i | grep ini
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: undefined symbol: zend_unset_property in Unknown on line 0
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
Scan this dir for additional .ini files => /etc/php/5.6/cli/conf.d
Additional .ini files parsed => /etc/php/5.6/cli/conf.d/10-mysqlnd.ini,
/etc/php/5.6/cli/conf.d/10-opcache.ini,
/etc/php/5.6/cli/conf.d/10-pdo.ini,
/etc/php/5.6/cli/conf.d/15-xml.ini,
/etc/php/5.6/cli/conf.d/20-calendar.ini,
/etc/php/5.6/cli/conf.d/20-ctype.ini,
/etc/php/5.6/cli/conf.d/20-curl.ini,
/etc/php/5.6/cli/conf.d/20-dom.ini,
/etc/php/5.6/cli/conf.d/20-exif.ini,
/etc/php/5.6/cli/conf.d/20-fileinfo.ini,
/etc/php/5.6/cli/conf.d/20-ftp.ini,
/etc/php/5.6/cli/conf.d/20-gettext.ini,
/etc/php/5.6/cli/conf.d/20-iconv.ini,
/etc/php/5.6/cli/conf.d/20-json.ini,
/etc/php/5.6/cli/conf.d/20-mbstring.ini,
/etc/php/5.6/cli/conf.d/20-mysql.ini,
/etc/php/5.6/cli/conf.d/20-mysqli.ini,
/etc/php/5.6/cli/conf.d/20-pdo_mysql.ini,
/etc/php/5.6/cli/conf.d/20-phar.ini,
/etc/php/5.6/cli/conf.d/20-posix.ini,
/etc/php/5.6/cli/conf.d/20-readline.ini,
/etc/php/5.6/cli/conf.d/20-shmop.ini,
/etc/php/5.6/cli/conf.d/20-simplexml.ini,
/etc/php/5.6/cli/conf.d/20-sockets.ini,
/etc/php/5.6/cli/conf.d/20-sysvmsg.ini,
/etc/php/5.6/cli/conf.d/20-sysvsem.ini,
/etc/php/5.6/cli/conf.d/20-sysvshm.ini,
/etc/php/5.6/cli/conf.d/20-tokenizer.ini,
/etc/php/5.6/cli/conf.d/20-wddx.ini,
/etc/php/5.6/cli/conf.d/20-xmlreader.ini,
/etc/php/5.6/cli/conf.d/20-xmlwriter.ini,
/etc/php/5.6/cli/conf.d/20-xsl.ini
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
init_command_executed_count => 0
init_command_failed_count => 0
com_init_db => 0
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

这是实际警告

  

PHP警告:PHP启动:无法加载动态库   ' /usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so:   未定义的符号:第0行的未知中的zend_unset_property

还检查了cURL是否正常工作。任何形式的帮助都非常感谢。

3 个答案:

答案 0 :(得分:11)

将php5.6(-common)更新为更新版本。这可以使用apt-get update && apt-get upgrade完成。你刚刚将php5.6-curl更新到最新版本,但它取决于更新的php5.6。

答案 1 :(得分:5)

php7上的相同问题。刚做了apt-get dist-upgrade,现在警告已经消失,卷曲正常。希望它有所帮助!

答案 2 :(得分:1)

如果有人面对php 7.0的相同问题。 我用class PlaybackService : MediaBrowserServiceCompat() { private var mediaSession: MediaSessionCompat? = null private val stateBuilder: PlaybackStateCompat.Builder by lazy { PlaybackStateCompat.Builder().setActions( PlaybackStateCompat.ACTION_PLAY or PlaybackStateCompat.ACTION_PLAY_PAUSE or PlaybackStateCompat.ACTION_STOP or PlaybackStateCompat.ACTION_SKIP_TO_NEXT ) } override fun onCreate() { super.onCreate() mediaSession = MediaSessionCompat(this, "debug log").apply { setFlags(MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS or MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS) setPlaybackState(stateBuilder.build()) setCallback(object : MediaSessionCompat.Callback() { override fun onStop() { stop() } override fun onPause() { pause() } override fun onSkipToNext() { playNext() } }) setMediaButtonReceiver(MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_STOP)) } sessionToken = mediaSession!!.sessionToken } override fun onGetRoot(clientPackageName: String, clientUid: Int, rootHints: Bundle?): BrowserRoot? { } override fun onLoadChildren(parentId: String, result: Result<MutableList<MediaBrowserCompat.MediaItem>>) { } private fun startForeground() { mediaSession!!.isActive = true createNotificationChannel() var artist = PlayingAudioInfo.audio!!.artist if (artist.isNullOrBlank()) artist = "unknown artist" val builder = NotificationCompat.Builder(this, NOTI_CHANNEL_ID).apply { setContentIntent(mediaSession!!.controller.sessionActivity) // Stop the service when the notification is swiped away setDeleteIntent(MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_STOP)) setVisibility(NotificationCompat.VISIBILITY_PUBLIC) if (mNotification == null) //first time show it on status bar setTicker(title) getNextPlayerAudioImg()?.let { setLargeIcon(it) } setContentTitle(artist!! + title!!) setSubText(PlayingAudioInfo.audio!!.album) val album = PlayingAudioInfo.audio!!.album.takeIf { true } if (!album.isNullOrBlank()) setContentText(album) setSmallIcon(android.R.drawable.ic_media_play) // Add media control buttons that invoke intents in your media service addAction(R.drawable.ic_stop, "Stop", MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_STOP)) addAction(R.drawable.ic_stop, "Stop", MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_STOP)) addAction(R.drawable.ic_pause, "Pause", MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_PLAY_PAUSE)) addAction(R.drawable.ic_skip_next, "Next", MediaButtonReceiver.buildMediaButtonPendingIntent(this@PlaybackService, PlaybackStateCompat.ACTION_SKIP_TO_NEXT)) setStyle( android.support.v4.media.app.NotificationCompat.MediaStyle() .setShowActionsInCompactView(0, 1, 2) .setMediaSession(mediaSession!!.sessionToken) // Add a cancel button .setShowCancelButton(true) .setCancelButtonIntent( MediaButtonReceiver.buildMediaButtonPendingIntent( this@PlaybackService, PlaybackStateCompat.ACTION_STOP ) ) ) } mNotification = builder.build() startForeground(1, mNotification) } } 删除了旧的“ curl”,并用sudo apt-get remove "curl"安装了php 7.0版本。

消息现在消失了,一切正常。